Probe-Particle / ppafm

Classical force field model for simulating atomic force microscopy images.
MIT License
49 stars 18 forks source link

Too large color bar makes png figures ugly #252

Closed mondracek closed 8 months ago

mondracek commented 8 months ago

The figures generated with the --cbar option on and saved as PNG have the color-scale bar on their side too big. Compare this figure created by the current version of our code LCPD_atoms_cbar_018 and a version of the same figure after the change I am going to propose LCPD_atoms_cbar_018

The change would consist just in putting plt.colorbar(shrink=0.5) here https://github.com/Probe-Particle/ppafm/blob/18a5d8a68158e5ffc76d7988bb3e9a6a3b86ff2d/ppafm/PPPlot.py#L98

By the way, do not worry that the images I am comparing above as examples also have different contrast: The one generated with the code in our current main branch is wrong because of #250, but that is a separate issue (although if you do not mind solving it with one pull request, it may save me some hassle). Note that we need the above figure for the paper we are writing, which is why I started worrying about both factual correctness and nice layout.

NikoOinonen commented 8 months ago

Make sure that the shrink factor shrink=0.5 also looks reasonable for square images. It could be that you need to adjust it dynamically based on the image aspect ratio to something like shrink=(y_dim/x_dim).

mondracek commented 8 months ago

@NikoOinonen, thanks, good catch. I have uploaded a new commit to #251, which hopefully deals with the aspect ratio.

NikoOinonen commented 8 months ago

Closed by #251.