Is there an easy way to have text (specifically axis-label text) with a white outline color, but black fill color. My axis labels fall over portions of my graph that are in some areas are light and others dark, so some label are obscured.
An easy way to solve this problem would be to set the background color of the axis-label text object.
I find the square boxes distracting and if possible, would prefer that the text itself has an inverse oreo coloring.
Before going down a rabbit hole with this, I thought I would ask if anyone knows a simple way to do this.
Thank you for any thoughts.
MatPlotLib with Python To place the legend, use legend() method with location of the legend and store the returned value to set the color of the text. To set the color of the text, use set_color() method with green color. To display the figure, use show() method.
Matplotlib can use font families installed on the user's computer, i.e. Helvetica, Times, etc. Font families can also be specified with generic-family aliases like ( {'cursive', 'fantasy', 'monospace', 'sans', 'sans serif', 'sans-serif', 'serif'} ).
The usual way to set the line color in matplotlib is to specify it in the plot command. This can either be done by a string after the data, e.g. "r-" for a red line, or by explicitely stating the color argument.
You should be able to pull this off using PathEffects
, and ax.(x/y)axis.label
or ax.get_(x/y)ticklabels()
to get the txt
objects.
See the examples here: http://matplotlib.org/examples/pylab_examples/patheffect_demo.html
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