Mathematica: DiscretePlot type plot with x values from a list

In summary, the speaker is looking for a way to plot vertical lines with dots at the top, using x-positions and heights from a set of coordinates. The suggestion is to use ListPlot with the option Filling->Axis. The speaker also asks for advice on how to plot complex numbers as a function of t using ListPointPlot3D, but notes that the Filling->Axis option doesn't work in this case. They mention having to manipulate the data to get the desired plot and ask for the best approach for this type of plot.
  • #1
Swamp Thing
Insights Author
901
563
TL;DR Summary
Is it possible to get something that looks like DiscretePlot, but taking both the X *and* Y values from a list?
I would like vertical lines with dots at the top of them, with the x-positions and heights coming from
{{1.2, 3.5}, {2.3, 4.2}, {5.5, 6.7}} for example.
 
Physics news on Phys.org
  • #2
Try ListPlot with the option Filling->Axis
 
  • Like
Likes Swamp Thing and DrClaude
  • #3
That's exactly what I needed, thanks.

And another question, if I may: I have used ListPointPlot3D to show some complex numbers as a function of some ##t## that goes along the length of the box:
1585187196967.png


However, the Filling->Axis doesn't help here because it sends each line downwards rather than towards the ##t## axis.

I had to doctor the data and insert ##0 + i0## before and after each complex number to get the above plot -- so ListPointPlot3D is probably the wrong type of plot for this.

What is the best way to do this?
 
Last edited:

1. How do I create a DiscretePlot type plot in Mathematica using x values from a list?

To create a DiscretePlot type plot in Mathematica with x values from a list, use the DiscretePlot function and specify the list of x values as the first argument. For example:
DiscretePlot[{2, 4, 6, 8}, {x, 1, 4}]

2. Can I customize the appearance of the DiscretePlot type plot?

Yes, you can customize the appearance of the DiscretePlot type plot by using various options such as PlotStyle, PlotMarkers, and PlotLegends. These options allow you to change the color, style, and labeling of the plot.

3. How do I add labels to my DiscretePlot type plot?

To add labels to your DiscretePlot type plot, you can use the PlotLabel option to specify the title of the plot, and the AxesLabel option to label the x and y axes. You can also use the Epilog option to add additional text or graphics to the plot.

4. Can I plot multiple datasets in the same DiscretePlot type plot?

Yes, you can plot multiple datasets in the same DiscretePlot type plot by using the Show function. Simply create separate DiscretePlots for each dataset and then use Show to combine them into one plot. You can also use the PlotLegends option to label each dataset.

5. Can I change the range of the x values in my DiscretePlot type plot?

Yes, you can change the range of the x values in your DiscretePlot type plot by specifying the desired range in the second argument of the DiscretePlot function. You can also use the PlotRange option to further customize the range of the plot.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
731
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
22
Views
3K
Back
Top