1
1
---
2
- permalink: python/line-charts/
2
+ permalink: python/line-charts
3
3
description: How to make line charts in Python with Plotly. Examples on creating and styling line charts in Python with Plotly.
4
- title : Python Line Charts | plotly
4
+ name : Python Line Charts | plotly
5
5
has_thumbnail: true
6
6
thumbnail: thumbnail/line-plot.jpg
7
7
layout: user-guide
8
8
name: Line Charts
9
9
language: python
10
+ title: Python Line Charts | plotly
10
11
display_as: basic
11
12
has_thumbnail: true
12
13
page_type: example_index
13
- order: 2
14
+ order: 3
14
15
---
15
16
{% raw %}
16
17
< div class ="cell border-box-sizing text_cell rendered ">
17
18
< div class ="prompt input_prompt ">
18
19
</ div >
19
20
< div class ="inner_cell ">
20
21
< div class ="text_cell_render border-box-sizing rendered_html ">
21
- < h1 id ="Line-Charts-in-Python "> Line Charts in Python< a class ="anchor-link " href ="#Line-Charts-in-Python "> ¶</ a > </ h1 >
22
- </ div >
23
- </ div >
24
- </ div >
25
- < div class ="cell border-box-sizing text_cell rendered ">
26
- < div class ="prompt input_prompt ">
27
- </ div >
28
- < div class ="inner_cell ">
29
- < div class ="text_cell_render border-box-sizing rendered_html ">
30
- < p > Learn about API authentication here: < a href ="https://plot.ly/python/getting-started "> https://plot.ly/python/getting-started</ a >
31
- < br > Find your api_key here: < a href ="https://plot.ly/settings/api "> https://plot.ly/settings/api</ a > </ p >
22
+ < h4 id ="API-Authentication "> API Authentication< a class ="anchor-link " href ="#API-Authentication "> ¶</ a > </ h4 > < p > New to Plotly's python API? < br >
23
+ Learn about API authentication here: < a href ="https://plot.ly/python/getting-started "> https://plot.ly/python/getting-started</ a > < br >
24
+ Find your api_key here: < a href ="https://plot.ly/settings/api "> https://plot.ly/settings/api</ a > </ p >
32
25
33
26
</ div >
34
27
</ div >
@@ -44,7 +37,7 @@ <h5 id="Simple-Line-Plot">Simple Line Plot<a class="anchor-link" href="#Simple-L
44
37
</ div >
45
38
< div class ="cell border-box-sizing code_cell rendered ">
46
39
< div class ="input ">
47
- < div class ="prompt input_prompt "> In [7 ]:</ div >
40
+ < div class ="prompt input_prompt "> In [2 ]:</ div >
48
41
< div class ="inner_cell ">
49
42
< div class ="input_area ">
50
43
< div class =" highlight hl-ipython2 "> < pre > < span class ="kn "> import</ span > < span class ="nn "> plotly.plotly</ span > < span class ="kn "> as</ span > < span class ="nn "> py</ span >
@@ -79,10 +72,10 @@ <h5 id="Simple-Line-Plot">Simple Line Plot<a class="anchor-link" href="#Simple-L
79
72
< div class ="output ">
80
73
81
74
82
- < div class ="output_area "> < div class ="prompt output_prompt "> Out[7 ]:</ div >
75
+ < div class ="output_area "> < div class ="prompt output_prompt "> Out[2 ]:</ div >
83
76
84
77
< div class ="output_html rendered_html output_subarea output_execute_result ">
85
- < iframe id ="igraph " scrolling ="no " style ="border:none; "seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8758.embed " height ="525px " width ="100% "> </ iframe >
78
+ < iframe id ="igraph " scrolling ="no " style ="border:none; " seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8758.embed " height ="525px " width ="100% "> </ iframe >
86
79
</ div >
87
80
88
81
</ div >
@@ -102,7 +95,7 @@ <h5 id="Line-Plot-Modes">Line Plot Modes<a class="anchor-link" href="#Line-Plot-
102
95
</ div >
103
96
< div class ="cell border-box-sizing code_cell rendered ">
104
97
< div class ="input ">
105
- < div class ="prompt input_prompt "> In [8 ]:</ div >
98
+ < div class ="prompt input_prompt "> In [3 ]:</ div >
106
99
< div class ="inner_cell ">
107
100
< div class ="input_area ">
108
101
< div class =" highlight hl-ipython2 "> < pre > < span class ="kn "> import</ span > < span class ="nn "> plotly.plotly</ span > < span class ="kn "> as</ span > < span class ="nn "> py</ span >
@@ -150,10 +143,10 @@ <h5 id="Line-Plot-Modes">Line Plot Modes<a class="anchor-link" href="#Line-Plot-
150
143
< div class ="output ">
151
144
152
145
153
- < div class ="output_area "> < div class ="prompt output_prompt "> Out[8 ]:</ div >
146
+ < div class ="output_area "> < div class ="prompt output_prompt "> Out[3 ]:</ div >
154
147
155
148
< div class ="output_html rendered_html output_subarea output_execute_result ">
156
- < iframe id ="igraph " scrolling ="no " style ="border:none; "seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8776.embed " height ="525px " width ="100% "> </ iframe >
149
+ < iframe id ="igraph " scrolling ="no " style ="border:none; " seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8776.embed " height ="525px " width ="100% "> </ iframe >
157
150
</ div >
158
151
159
152
</ div >
@@ -167,24 +160,15 @@ <h5 id="Line-Plot-Modes">Line Plot Modes<a class="anchor-link" href="#Line-Plot-
167
160
</ div >
168
161
< div class ="inner_cell ">
169
162
< div class ="text_cell_render border-box-sizing rendered_html ">
170
- < h5 id ="Style-Line-Plots "> Style Line Plots< a class ="anchor-link " href ="#Style-Line-Plots "> ¶</ a > </ h5 >
171
- </ div >
172
- </ div >
173
- </ div >
174
- < div class ="cell border-box-sizing text_cell rendered ">
175
- < div class ="prompt input_prompt ">
176
- </ div >
177
- < div class ="inner_cell ">
178
- < div class ="text_cell_render border-box-sizing rendered_html ">
179
- < p > This example styles the color and dash of the traces, adds trace names,
163
+ < h5 id ="Style-Line-Plots "> Style Line Plots< a class ="anchor-link " href ="#Style-Line-Plots "> ¶</ a > </ h5 > < p > This example styles the color and dash of the traces, adds trace names,
180
164
modifiys line width, and adds plot and axes titles.</ p >
181
165
182
166
</ div >
183
167
</ div >
184
168
</ div >
185
169
< div class ="cell border-box-sizing code_cell rendered ">
186
170
< div class ="input ">
187
- < div class ="prompt input_prompt "> In [9 ]:</ div >
171
+ < div class ="prompt input_prompt "> In [4 ]:</ div >
188
172
< div class ="inner_cell ">
189
173
< div class ="input_area ">
190
174
< div class =" highlight hl-ipython2 "> < pre > < span class ="kn "> import</ span > < span class ="nn "> plotly.plotly</ span > < span class ="kn "> as</ span > < span class ="nn "> py</ span >
@@ -274,10 +258,10 @@ <h5 id="Style-Line-Plots">Style Line Plots<a class="anchor-link" href="#Style-Li
274
258
< div class ="output ">
275
259
276
260
277
- < div class ="output_area "> < div class ="prompt output_prompt "> Out[9 ]:</ div >
261
+ < div class ="output_area "> < div class ="prompt output_prompt "> Out[4 ]:</ div >
278
262
279
263
< div class ="output_html rendered_html output_subarea output_execute_result ">
280
- < iframe id ="igraph " scrolling ="no " style ="border:none; "seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8761.embed " height ="525px " width ="100% "> </ iframe >
264
+ < iframe id ="igraph " scrolling ="no " style ="border:none; " seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8761.embed " height ="525px " width ="100% "> </ iframe >
281
265
</ div >
282
266
283
267
</ div >
@@ -297,14 +281,14 @@ <h5 id="Connect-Data-Gaps">Connect Data Gaps<a class="anchor-link" href="#Connec
297
281
</ div >
298
282
< div class ="cell border-box-sizing code_cell rendered ">
299
283
< div class ="input ">
300
- < div class ="prompt input_prompt "> In [10 ]:</ div >
284
+ < div class ="prompt input_prompt "> In [5 ]:</ div >
301
285
< div class ="inner_cell ">
302
286
< div class ="input_area ">
303
287
< div class =" highlight hl-ipython2 "> < pre > < span class ="kn "> import</ span > < span class ="nn "> plotly.plotly</ span > < span class ="kn "> as</ span > < span class ="nn "> py</ span >
304
288
< span class ="kn "> import</ span > < span class ="nn "> plotly.graph_objs</ span > < span class ="kn "> as</ span > < span class ="nn "> go</ span >
305
289
306
290
< span class ="n "> trace1</ span > < span class ="o "> =</ span > < span class ="n "> go</ span > < span class ="o "> .</ span > < span class ="n "> Scatter</ span > < span class ="p "> (</ span >
307
- < span class ="n "> x</ span > < span class ="o "> =</ span > < span class ="p "> [</ span > < span class ="mi "> 1</ span > < span class ="p "> ,</ span > < span class ="mi "> 2</ span > < span class ="p "> ,</ span > < span class ="mi "> 3</ span > < span class ="p "> ,</ span > < span class ="mi "> 4</ span > < span class ="p "> ,</ span > < span class ="mi "> 5</ span > < span class ="p "> ,</ span >
291
+ < span class ="n "> x</ span > < span class ="o "> =</ span > < span class ="p "> [</ span > < span class ="mi "> 1</ span > < span class ="p "> ,</ span > < span class ="mi "> 2</ span > < span class ="p "> ,</ span > < span class ="mi "> 3</ span > < span class ="p "> ,</ span > < span class ="mi "> 4</ span > < span class ="p "> ,</ span > < span class ="mi "> 5</ span > < span class ="p "> ,</ span >
308
292
< span class ="mi "> 6</ span > < span class ="p "> ,</ span > < span class ="mi "> 7</ span > < span class ="p "> ,</ span > < span class ="mi "> 8</ span > < span class ="p "> ,</ span > < span class ="mi "> 9</ span > < span class ="p "> ,</ span > < span class ="mi "> 10</ span > < span class ="p "> ,</ span >
309
293
< span class ="mi "> 11</ span > < span class ="p "> ,</ span > < span class ="mi "> 12</ span > < span class ="p "> ,</ span > < span class ="mi "> 13</ span > < span class ="p "> ,</ span > < span class ="mi "> 14</ span > < span class ="p "> ,</ span > < span class ="mi "> 15</ span > < span class ="p "> ],</ span >
310
294
< span class ="n "> y</ span > < span class ="o "> =</ span > < span class ="p "> [</ span > < span class ="mi "> 10</ span > < span class ="p "> ,</ span > < span class ="mi "> 20</ span > < span class ="p "> ,</ span > < span class ="bp "> None</ span > < span class ="p "> ,</ span > < span class ="mi "> 15</ span > < span class ="p "> ,</ span > < span class ="mi "> 10</ span > < span class ="p "> ,</ span >
@@ -337,10 +321,10 @@ <h5 id="Connect-Data-Gaps">Connect Data Gaps<a class="anchor-link" href="#Connec
337
321
< div class ="output ">
338
322
339
323
340
- < div class ="output_area "> < div class ="prompt output_prompt "> Out[10 ]:</ div >
324
+ < div class ="output_area "> < div class ="prompt output_prompt "> Out[5 ]:</ div >
341
325
342
326
< div class ="output_html rendered_html output_subarea output_execute_result ">
343
- < iframe id ="igraph " scrolling ="no " style ="border:none; "seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8770.embed " height ="525px " width ="100% "> </ iframe >
327
+ < iframe id ="igraph " scrolling ="no " style ="border:none; " seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8770.embed " height ="525px " width ="100% "> </ iframe >
344
328
</ div >
345
329
346
330
</ div >
@@ -360,7 +344,7 @@ <h5 id="Interpolation-with-Line-Plots">Interpolation with Line Plots<a class="an
360
344
</ div >
361
345
< div class ="cell border-box-sizing code_cell rendered ">
362
346
< div class ="input ">
363
- < div class ="prompt input_prompt "> In [11 ]:</ div >
347
+ < div class ="prompt input_prompt "> In [6 ]:</ div >
364
348
< div class ="inner_cell ">
365
349
< div class ="input_area ">
366
350
< div class =" highlight hl-ipython2 "> < pre > < span class ="kn "> import</ span > < span class ="nn "> plotly.plotly</ span > < span class ="kn "> as</ span > < span class ="nn "> py</ span >
@@ -449,10 +433,10 @@ <h5 id="Interpolation-with-Line-Plots">Interpolation with Line Plots<a class="an
449
433
< div class ="output ">
450
434
451
435
452
- < div class ="output_area "> < div class ="prompt output_prompt "> Out[11 ]:</ div >
436
+ < div class ="output_area "> < div class ="prompt output_prompt "> Out[6 ]:</ div >
453
437
454
438
< div class ="output_html rendered_html output_subarea output_execute_result ">
455
- < iframe id ="igraph " scrolling ="no " style ="border:none; "seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8766.embed " height ="525px " width ="100% "> </ iframe >
439
+ < iframe id ="igraph " scrolling ="no " style ="border:none; " seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8766.embed " height ="525px " width ="100% "> </ iframe >
456
440
</ div >
457
441
458
442
</ div >
@@ -472,7 +456,7 @@ <h5 id="Label-Lines-with-Annotations">Label Lines with Annotations<a class="anch
472
456
</ div >
473
457
< div class ="cell border-box-sizing code_cell rendered ">
474
458
< div class ="input ">
475
- < div class ="prompt input_prompt "> In [12 ]:</ div >
459
+ < div class ="prompt input_prompt "> In [7 ]:</ div >
476
460
< div class ="inner_cell ">
477
461
< div class ="input_area ">
478
462
< div class =" highlight hl-ipython2 "> < pre > < span class ="kn "> import</ span > < span class ="nn "> plotly.plotly</ span > < span class ="kn "> as</ span > < span class ="nn "> py</ span >
@@ -609,10 +593,10 @@ <h5 id="Label-Lines-with-Annotations">Label Lines with Annotations<a class="anch
609
593
< div class ="output ">
610
594
611
595
612
- < div class ="output_area "> < div class ="prompt output_prompt "> Out[12 ]:</ div >
596
+ < div class ="output_area "> < div class ="prompt output_prompt "> Out[7 ]:</ div >
613
597
614
598
< div class ="output_html rendered_html output_subarea output_execute_result ">
615
- < iframe id ="igraph " scrolling ="no " style ="border:none; "seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8773.embed " height ="600px " width ="600px "> </ iframe >
599
+ < iframe id ="igraph " scrolling ="no " style ="border:none; " seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/8773.embed " height ="600px " width ="600px "> </ iframe >
616
600
</ div >
617
601
618
602
</ div >
@@ -626,13 +610,13 @@ <h5 id="Label-Lines-with-Annotations">Label Lines with Annotations<a class="anch
626
610
</ div >
627
611
< div class ="inner_cell ">
628
612
< div class ="text_cell_render border-box-sizing rendered_html ">
629
- < h5 id ="Filled-Lines "> Filled Lines< a class ="anchor-link " href ="#Filled-Lines "> ¶</ a > </ h5 >
613
+ < h4 id ="Filled-Lines "> Filled Lines< a class ="anchor-link " href ="#Filled-Lines "> ¶</ a > </ h4 >
630
614
</ div >
631
615
</ div >
632
616
</ div >
633
617
< div class ="cell border-box-sizing code_cell rendered ">
634
618
< div class ="input ">
635
- < div class ="prompt input_prompt "> In [1 ]:</ div >
619
+ < div class ="prompt input_prompt "> In [8 ]:</ div >
636
620
< div class ="inner_cell ">
637
621
< div class ="input_area ">
638
622
< div class =" highlight hl-ipython2 "> < pre > < span class ="kn "> import</ span > < span class ="nn "> plotly.plotly</ span > < span class ="kn "> as</ span > < span class ="nn "> py</ span >
@@ -745,10 +729,10 @@ <h5 id="Filled-Lines">Filled Lines<a class="anchor-link" href="#Filled-Lines">&#
745
729
< div class ="output ">
746
730
747
731
748
- < div class ="output_area "> < div class ="prompt output_prompt "> Out[1 ]:</ div >
732
+ < div class ="output_area "> < div class ="prompt output_prompt "> Out[8 ]:</ div >
749
733
750
734
< div class ="output_html rendered_html output_subarea output_execute_result ">
751
- < iframe id ="igraph " scrolling ="no " style ="border:none; "seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/10921.embed " height ="525px " width ="100% "> </ iframe >
735
+ < iframe id ="igraph " scrolling ="no " style ="border:none; " seamless ="seamless " src ="https://plot.ly/~chelsea_lyn/10921.embed " height ="525px " width ="100% "> </ iframe >
752
736
</ div >
753
737
754
738
</ div >
@@ -771,8 +755,8 @@ <h3 id="References">References<a class="anchor-link" href="#References">¶</
771
755
</ div >
772
756
< div class ="inner_cell ">
773
757
< div class ="text_cell_render border-box-sizing rendered_html ">
774
- < p > See < a href ="https://plot.ly/python/reference/#scatter "> https://plot.ly/python/reference/#scatter</ a > for more information</ p >
758
+ < p > See < a href ="https://plot.ly/python/reference/#scatter "> https://plot.ly/python/reference/#scatter</ a > for more information and chart attribute options! </ p >
775
759
776
760
</ div >
777
761
</ div >
778
- </ div > {% endraw %}
762
+ </ div > {% endraw %}
0 commit comments