O'Reilly logo

Python Data Visualization Cookbook - Second Edition by Giuseppe Vettigli, Dimitry Foures, Igor Milovanović

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating line charts

In this recipe, we will see how to create a line chart. We have already introduced this kind of chart in Chapter 3, Drawing Your First Plots and Customizing Them, and we have seen how to make the plots with matplotlib. This time we'll focus on how to create and share them with Plot.ly.

Getting ready

Before starting, you need to set up your credentials for the Plot.ly platform in the programming environment:

$ python -c "import plotly; plotly.tools.set_credentials_file(username='DemoAccount', api_key='mykey')"

Replace Demo Account and mykey with your Plotly username and API key.

How to do it...

The following code example demonstrates how to plot two curves. In particular, we will:

  1. Generate the data to plot (a sine and a cosine wave). ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required