ComeçarComece de graça

Define the color palette of your plots

When visualizing multiple time series, it can be difficult to differentiate between various colors in the default color scheme.

To remedy this, you can define each color manually, but this may be time-consuming. Fortunately, it is possible to leverage the colormap argument to .plot() to automatically assign specific color palettes with varying contrasts. You can either provide a matplotlib colormap as an input to this parameter, or provide one of the default strings that is available in the colormap() function available in matplotlib (all of which are available here).

For example, you can specify the 'viridis' colormap using the following command:

df.plot(colormap='viridis')

Este exercício faz parte do curso

Visualizing Time Series Data in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Plot time series dataset using the cubehelix color palette
ax = meat.plot(colormap=____, fontsize=15)

# Additional customizations
ax.set_xlabel('Date')
ax.legend(fontsize=18)

# Show plot
plt.show()
Editar e executar o código