I'm running ipython notebook on a dark theme. When I build a chart on this, the chart is white, but the frame is transparent (hence dark), hiding the ticks which are also dark. Is there a way to make the frame not transparent/ white?
The ticks are barely visible due to black background.
How do I solve this? Thanks!
Edit: This is not about changing the colors of axis, ticks/labels, I'm thinking of adding a white background frame, not changing the colors of ticks - it'll be ugly if I just change the color of the ticks because the figure is white
Changing the Defaults: rcParams Each time Matplotlib loads, it defines a runtime configuration (rc) containing the default styles for every plot element you create. This configuration can be adjusted at any time using the plt.
BboxTransformTo is a transformation that linearly transforms points from the unit bounding box to a given Bbox. In your case, the transform itself is based upon a TransformedBBox which again has a Bbox upon which it is based and a transform - for this nested instance an Affine2D transform.
To hide the grid, use plt. To hide the axes, use plt.axis('off') To activate the labels' legend, use the legend() method. To display the figure, use the show() method.
How to hide axis in matplotlib figure? The matplotlib. pyplot. axis('off') command us used to hide the axis(both x-axis & y-axis) in the matplotlib figure.
The figure shown in jupyter with the %matplotlib inline
backend (which is often the default) is created via saving it through savefig
to a png that is then displayed. savefig
has an argument facecolor
which sets the color of the figure background. This can be set to white, e.g. fig.savefig("name.png", facecolor="w")
.
The options for saving can be adapted in the jupyter configuration. To achieve a white background one can set
%config InlineBackend.print_figure_kwargs={'facecolor' : "w"}
in a cell prior to showing the plot.
If that is to be used for every notebook, it can also be added to the ipython configuration file
c = get_config()
c.InlineBackend.print_figure_kwargs={'facecolor' : "w"}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With