Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.9K Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Changing the plot range?

Posted 5 years ago

If y(x) <0 for all x, ListPlot plots negative y values. How do i keep y(x) below the x axis, re-labeling the y axis (e.g., -20 -> 20)?

enter image description here

POSTED BY: Alan Beilis
5 Replies
Posted 5 years ago

Thanks Ahmed. It worked!

POSTED BY: Alan Beilis

What about that

Plot[Tan[x], {x, 0, 10}, PlotRange -> {-10, 0}, 
 Ticks -> {{2, 4, 6, 8}, {{-2, 2}, {-4, 4}, {-6, 6}}}]
POSTED BY: Ahmed Elbanna
Posted 5 years ago

That might do it. I'll try. Thanks

POSTED BY: Alan Beilis
Posted 5 years ago

Thanks Ahmed. However, the example you provided simply cuts off the negative values. That isn't what I need though. If you look at my plot above, I only want to change the appearance of the negative y values, maintaining the curve as is: literally only change -5 to 5, -10 to 10, -15 to 15, -20 to 20.

POSTED BY: Alan Beilis

Hi Alan

This option answers you question https://reference.wolfram.com/language/ref/PlotRange.html Here is an example, try to evaluate both:

Plot[Tan[x], {x, 0, 10}, PlotRange ->{-10,10}]
Plot[Tan[x], {x, 0, 10}, PlotRange ->{0,5}]
POSTED BY: Ahmed Elbanna
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard