2

I used matplotlib to make a plot as shown in the attached file. enter image description here

There is not much data on this plot at the moment but I foresee that most of the data will be on the positive side of the y axis while a minority will be on the negative side. I want to ask if there is a way to say, compress the negative axis, or scale up the positive y-axis, so that the positive part of the y-axis takes up a larger representative part of the plot? To illustrate my point, I also attach another roughly drawn figure of what I want to achieve.

enter image description here The positive y-axis should at least take up 50% of the plot (or more) and it ranges from a value of 0 to 1.0. The negative y-axis however would take up 50% or less of the plot height and it ranges from a value of 0 to -10.0.

How should I go about doing this?

Craver2000
  • 433
  • 1
  • 7
  • 24
  • Is there a specific reason to do this? This data representation is misleading and will cause misinterpretation. What would be acceptable and meets your need, is a logarithmic scale between 1 and -10. [You have of course take care of the zero value in this case](https://stackoverflow.com/q/16382917/8881141) – Mr. T Feb 04 '18 at 15:16
  • As I obtain more data over time, I foresee my variable (R^2) accumulating in the positive y-axis area between o to 1.0. The negative part of the y axis is to accomodate some of these negative values. However, I prefer to have a larger representative part of the plot where most of my data will be plotted in, and I will be willing to accept if some negative values might exceed -10.0, and will thus will not be shown on the plot. Misinterpretation would certainly be a potential issue, but the plot will be mainly for my own reference. – Craver2000 Feb 04 '18 at 15:23
  • I did consider using a logarithmic scale, however I desire for my positive y-axis to be left unskewed, so that I can make better comparison between the data on this part of the axis, but I am ok if there is skewing of the negative axis. I tried applying a log scale to the negative y-axis but it doesnt seem to make a difference, unless I am plotting for even larger negative values like -100 or -1000. – Craver2000 Feb 04 '18 at 15:24
  • 2
    If it is just for your own use, you can represent your data as you like. Different thing, if it is published. You could treat positive and negative values as [two groups in your plot, so they can have different scales](https://stackoverflow.com/a/7734614/8881141) – Mr. T Feb 04 '18 at 15:52
  • Thanks for the suggestion, I just did that and it looks alright. I have my top plot showing only the positive values and the bottom one showing a more distant range of both axes. I'll continue to see how this approach works out over time. – Craver2000 Feb 04 '18 at 16:21
  • If this is your preferred solution, you can [answer your own question](https://stackoverflow.com/help/self-answer) and accept it. – Mr. T Feb 04 '18 at 16:23
  • Does this answer your question? [Matplotlib: different scale on negative side of the axis](https://stackoverflow.com/questions/53699677/matplotlib-different-scale-on-negative-side-of-the-axis) – tommy.carstensen Sep 03 '20 at 19:14

0 Answers0