How can I use colors that have a long name and custom markers in Pandas?
With standard colors I would do:
df.plot(style = 'ro')
but I cannot do:
df.plot(style = 'lightgreeno')
I tried:
df.plot(color = 'lightgreen', style = 'o')
but I get:
ValueError: Cannot pass 'style' string with a color symbol and 'color' keyword argument. Please use one or the other or pass 'style' without a color symbol
any ideas?
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 can set the labels on that object. Or, more succinctly: ax. set(xlabel="x label", ylabel="y label") . Alternatively, the index x-axis label is automatically set to the Index name, if it has one.
style wraps color and marker and linestyle together. As soon as you specify one of those explicitly, you need to be explicit about any of them. An example from the plot documentation:
plot(x, y, color='green', linestyle='dashed', marker='o', markerfacecolor='blue', markersize=12).
so in your line change style to marker :
df.plot(color = 'lightgreen', marker = 'o')
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