matplotlib axis scale

matplotlib axis scale One thing you can do is to set your axis range by yourself by using matplotlib pyplot axis matplotlib pyplot axis from matplotlib import pyplot as pltplt axis 0 10 0 20 0 10 is for x axis range 0 20 is for y axis range or you can also use matplotlib pyplot xlim or matplotlib pyplot ylim

Def autoscale y ax margin 0 1 This function rescales the y axis based on the data that is visible given the current xlim of the axis ax a matplotlib axes object margin the fraction of the total height of the y data to pad the upper and lower ylims import numpy as np def get bottom top line Might be able to help work out the issue quicker P axis equal seems to be like P gca set aspect equal adjustable datalim While if adjustable box then the plot becomes square I definitely do not get a square box out of this Earn 10 reputation not counting the in order to answer this question

matplotlib axis scale

matplotlib-set-axis-range-python-guides

matplotlib axis scale
https://pythonguides.com/wp-content/uploads/2022/01/matplotlib-set-axis-range.png

python-custom-matplotlib-axis-scale-stack-overflow

Python Custom Matplotlib Axis Scale Stack Overflow
https://i.stack.imgur.com/UEHkZ.jpg

python-matplotlib-how-to-scale-an-axis-stack-overflow

Python Matplotlib How To Scale An Axis Stack Overflow
https://i.stack.imgur.com/pYyG0.png

That allows you to change the scale after the Axes object is created That would also allow you to build a control to let the user pick the scale if you needed to The relevant line to add is ax set yscale log You can use linear to switch back to a As has been mentioned you can use ticklabel format to specify that matplotlib should use scientific notation for large or small values ax ticklabel format style sci scilimits 3 4 axis both You can affect the way that this is displayed using the flags in rcParams from matplotlib import rcParams or by setting them directly

Another way not purely matplotlib or maybe overkill if you don t use seaborn is to just set the font scale with seaborn sns set context paper font scale 1 4 DISCLAIMER I know if you only use matplotlib then probably you don t want to install a whole module for just scaling your plots I mean why not or if you use seaborn then you have more control over the options To make a semi log plot with x scale logarithmic there are two options import matplotlib pyplot as plt fig ax plt subplots ax plot x y ax set xscale log or import matplotlib pyplot as plt fig ax plt subplots ax semilogx x y If you do not need to set the xticks this two are both fine

More picture related to matplotlib axis scale

python-axis-scale-will-not-change-with-matplotlib-stack-overflow

Python Axis Scale Will Not Change With Matplotlib Stack Overflow
https://i.stack.imgur.com/fIScI.png

how-to-create-matplotlib-plots-with-log-scales-statology

How To Create Matplotlib Plots With Log Scales Statology
https://www.statology.org/wp-content/uploads/2020/09/logscale2.png

plots-with-different-scales-matplotlib-2-2-2-documentation

Plots With Different Scales Matplotlib 2 2 2 Documentation
https://matplotlib.org/2.2.2/_images/sphx_glr_two_scales_001.png

It looks like you want an identical plot but only change the tick values you can do that by getting the tick values and then just changing them to whatever you want So for your need it would be like this ticks your plot get xticks 10 9 your plot set xticklabels ticks edited From mpl toolkits mplot3d import Axes3D from matplotlib import cm import matplotlib pyplot as plt import numpy as np def set axes equal ax Make axes of 3D plot have equal scale so that spheres appear as spheres cubes as cubes etc Input ax

[desc-10] [desc-11]

python-how-to-scale-an-axis-in-matplotlib-and-avoid-axes-plotting

Python How To Scale An Axis In Matplotlib And Avoid Axes Plotting
https://i.stack.imgur.com/GXZIi.png

y-axis-label-cut-off-in-log-scale-issue-464-matplotlib-ipympl-github

Y Axis Label Cut Off In Log Scale Issue 464 Matplotlib ipympl GitHub
https://user-images.githubusercontent.com/7684542/164721796-1cf71c49-d187-4ce2-a36e-9c52c113d818.png

matplotlib axis scale - [desc-14]