Improving the quality of the figure
Hi, I am the user of the chemplot, I want to use the figure that come out from the chemplot.
But I have two problems:
- I want to remove the color of background, and use a transparent or white background. Can you provide this selection for the users?
- The scatter points is small for me, and I wan they are larger than the default one. Can you provide the selection of marker size for the users? In this case, the code is nicer to the users. I will thank you vey much if my problems can be solved.
Hi @XuanZhoudiffer,
The figure that comes out of visualize_plot() is a matplotlib.axes.Axes. You can therefore update its values by changing the axis attributes!
- For the background for example you can change the facecolor attribute:
ax = plotter_object.visualize_plot()
ax.set_facecolor('white') # Add your desired color here
ax.figure.savefig(fname='plot.png')
- For the dot sizes you can modify the collection of the plot size:
ax = plotter_object.visualize_plot()
ax.collections[0].set_sizes([300]) # Add your size here instead of 300
ax.figure.savefig(fname='plot.png')
These manipulations require some knowledge of the Axis attributes of matplotlib. I am leaving the issue open as to make it easier we will add the possibility to pass kwargs used by matplotlib.axes.Axes.scatter(), over which the scatter version of visualize_plot() is built on top, directly to visualize_plot(). This way you won't have to manipulate the figure after it is created.