How to Create Horizontal Filling to the Y-Axis in Mathematica?

  • Context: Mathematica 
  • Thread starter Thread starter cryptist
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around how to create horizontal filling lines to the y-axis in Mathematica, specifically in the context of using the ListPlot function. Participants explore various methods and commands to achieve this effect, addressing both theoretical and practical aspects of the implementation.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant notes that the Filling->Axis command creates vertical lines to the x-axis and seeks a method for horizontal lines to the y-axis.
  • Another participant references a Stack Overflow link, suggesting that the task may not be straightforward and recommends starting with existing examples to adapt them.
  • A participant shares their attempt to use a specific command to swap x and y coordinates but indicates it did not work with ListPlot, resulting in no output.
  • There is a request for a minimal example dataset and a clear explanation of the desired outcome to facilitate assistance.
  • One participant provides a working example of ListPlot with filling to the x-axis and expresses the desire for a similar filling to the y-axis.
  • A later reply acknowledges the importance of clear examples and suggests a combined approach using ListPlot and Graphics to achieve the desired filling effect.

Areas of Agreement / Disagreement

Participants generally agree on the complexity of the task and the need for clear examples, but there is no consensus on a definitive solution for creating horizontal filling lines to the y-axis.

Contextual Notes

Some limitations include the potential misunderstanding of commands and the dependency on specific data structures. The discussion does not resolve the mathematical steps necessary to achieve the desired effect.

cryptist
Messages
121
Reaction score
1
Filling->Axis command makes vertical lines to the x-axis. How can I make same thing for the y-axis? (Horizontal lines to the y-axis)
 
Physics news on Phys.org
Study all the responses here and see if you can adapt it to what you need

http://stackoverflow.com/questions/6204898/plotting-on-the-y-axis-in-mathematica

This might not be an understandable or easy or dependable thing to do.

Start by trying to reproduce exactly the examples that they show. Then make very small changes and see if it continues to work. Try to figure out what went wrong and how to possibly correct it if it fails. Gradually work up to the actual problem you have.
 
Last edited:
I used this command: /. List[x_, y_] -> List[y, x]
But I guess it does not work for ListPlot. Mathematica didn't draw anything when I use that command. My data contains points generated by ListPlot and I want to draw horizontal filling lines from points to the y-axis.
 
Post the smallest simplest example dataset you can construct along with a simple clear explanation of what you want the result to look like and perhaps someone can see a way to accomplish what you are looking for.
 
Here is an example:

ListPlot[Table[{x, x*x}, {x, 1, 5, 1}], Filling -> Bottom,
PlotStyle -> {Black, PointSize[0.015]}]

When you plot the code above, there will be a filling from points to x-axis. I want also a filling from points to y-axis.

How can I do that?
 
Thank you. A good simple clear concrete example makes it much more likely to give you an answer like you are looking for.

In[1]:= Show[{
ListPlot[Table[{x, x*x}, {x, 1, 5, 1}], Filling -> Bottom, PlotStyle -> {Black, PointSize[0.015]}],
Graphics[Table[Line[{{1, x^2}, {x, x^2}}], {x, 1, 5, 1}]]
}]

Out[1]= ...PlotSnipped...

Then, only if you really need to, you spend minutes or hours or days fiddling with the hundreds of options and directives to adjust the style to try to get close to exactly what you want.
 
Last edited:
  • Like
Likes   Reactions: 1 person

Similar threads

  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K