Axis scaling

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
AKoehler
User
Beiträge: 3
Registriert: Montag 2. September 2019, 17:44

Hello people,

I am working on modeling a groundwater problem with jupyter notebook.
The model is working just fine, but I have a problem with my plot. Since the model domain has a length of 2500m and only a width of 2m the plot appears to be very thin.
Now I want to change the scaling of my x-axis so that I can something in my plot.
But I cant make it work. I tried setting the aspect ratio but it seems to have no effect.

Here is the code for the plot:

ax = plt.subplot(1,1,1)
ax.set_aspect(0.1)
mf, mt, conc, cvt, mvt = T01('T01', -1)
conc = conc[0, :, :, :]
mm = flopy.plot.PlotMapView(model=mf)
mm.plot_grid(color='.5', alpha=0.2)
cs = mm.contour_array(conc, levels=[16.], colors='k')
plt.clabel(cs)
plt.xlabel('DISTANCE ALONG X-AXIS, IN METERS')
plt.ylabel('DISTANCE ALONG Y-AXIS, IN METERS')
plt.title('ULTIMATE')


Does anyone have an idea how to change the scaling of the axis?
Thanks in advance, Anton.
simplesimon
User
Beiträge: 11
Registriert: Samstag 3. Dezember 2016, 21:50

Matplotlib allows the aspect ratio, DPI and figure size to be specified when the Figure object is created, using the figsize and dpi keyword arguments. figsize is a tuple of the width and height of the figure in inches, and dpi is the dots-per-inch (pixel per inch). To create an 800x400 pixel, 100 dots-per-inch figure, we can do (http://github.com/jrjohansson/scientifi ... n-lectures)

Beispiel:

x = np.linspace(0, 5, 10)
y = x ** 2

fig, axes = plt.subplots(figsize=(4,3))

axes.plot(x, y, 'r')
axes.set_xlabel('x')
axes.set_ylabel('y')
axes.set_title('title')
plt.show()
AKoehler
User
Beiträge: 3
Registriert: Montag 2. September 2019, 17:44

Thank you for your reply.
I tried changing the figsize, but it didn't work. I think what I might need to do is to change the actual lenght of the axis.
I have a picture of the results, changing the figsize, but unfortunately I don't know how to put it here... :shock:
AKoehler
User
Beiträge: 3
Registriert: Montag 2. September 2019, 17:44

I think I might have found the problem:
https://matplotlib.org/3.1.1/gallery/im ... agrid.html
Antworten