Skip to content

Commit cec6d7b

Browse files
author
alexlesinstruments
committed
IJulia Multiple Axes, Subplots and Insets Notebook
1 parent 24f8e86 commit cec6d7b

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
{
2+
"metadata": {
3+
"language": "Julia",
4+
"name": "Plotly iJulia Notebook - Multiple Axes, Subplots and Insets"
5+
},
6+
"nbformat": 3,
7+
"nbformat_minor": 0,
8+
"worksheets": [
9+
{
10+
"cells": [
11+
{
12+
"cell_type": "code",
13+
"collapsed": false,
14+
"input": "using Plotly\nPlotly.signin(\"demos\",\"tj6mr52zgp\")",
15+
"language": "python",
16+
"metadata": {},
17+
"outputs": [
18+
{
19+
"metadata": {},
20+
"output_type": "pyout",
21+
"prompt_number": 1,
22+
"text": "PlotlyAccount(\"demos\",\"tj6mr52zgp\")"
23+
}
24+
],
25+
"prompt_number": 1
26+
},
27+
{
28+
"cell_type": "code",
29+
"collapsed": false,
30+
"input": "data = [\n [\n \"x\"=>[1,2,3],\n \"y\"=>[40,50,60],\n \"name\"=>\"yaxis data\"\n ],\n [\n \"x\"=>[2,3,4],\n \"y\"=>[4,5,6],\n \"yaxis\"=>\"y2\", # this will reference the yaxis2 object in the layout object\n \"name\"=> \"yaxis2 data\"\n ] \n];\nlayout = [\n \"yaxis\"=>[\n \"title\"=> \"yaxis title\", # optional\n ],\n \"yaxis2\"=>[\n \"title\"=> \"yaxis2 title\", # optional\n \"titlefont\"=>[\n \"color\"=>\"rgb(148, 103, 189)\"\n ],\n \"tickfont\"=>[\n \"color\"=>\"rgb(148, 103, 189)\"\n ],\n \"overlaying\"=>\"y\",\n \"side\"=>\"right\",\n ], \n \"title\"=> \"Double Y Axis Example\",\n]\n\n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
31+
"language": "python",
32+
"metadata": {},
33+
"outputs": [
34+
{
35+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/774/700/700' width='750'></iframe>",
36+
"metadata": {},
37+
"output_type": "display_data"
38+
}
39+
],
40+
"prompt_number": 2
41+
},
42+
{
43+
"cell_type": "code",
44+
"collapsed": false,
45+
"input": "c = [\n \"#1f77b4\", # muted blue\n \"#ff7f0e\", # safety orange\n \"#2ca02c\", # cooked asparagus green\n \"#d62728\", # brick red\n \"#9467bd\", # muted purple\n \"#8c564b\", # chestnut brown\n \"#e377c2\", # raspberry yogurt pink\n \"#7f7f7f\", # middle gray\n \"#bcbd22\", # curry yellow-green\n \"#17becf\"]; #blue-teal\n\ndata = [\n [\n \"x\"=>[1,2,3],\n \"y\"=>[4,5,6],\n \"name\"=>\"yaxis1 data\"\n ],\n [\n \"x\"=>[2,3,4],\n \"y\"=>[40,50,60],\n \"name\"=>\"yaxis2 data\",\n \"yaxis\"=>\"y2\" # this references the \"yaxis2\" object in layout\n ],\n [\n \"x\"=>[3,4,5],\n \"y\"=>[400,500,600],\n \"name\"=>\"yaxis3 data\",\n \"yaxis\"=>\"y3\"\n ],\n [\n \"x\"=>[4,5,6],\n \"y\"=>[40000,50000,60000],\n \"name\"=>\"yaxis4 data\",\n \"yaxis\"=>\"y4\" \n ],\n [\n \"x\"=>[5,6,7],\n \"y\"=>[400000,500000,600000],\n \"name\"=>\"yaxis5 data\",\n \"yaxis\"=>\"y5\" \n ],\n [\n \"x\"=>[6,7,8],\n \"y\"=>[4000000,5000000,6000000],\n \"name\"=>\"yaxis6 data\",\n \"yaxis\"=>\"y6\" \n ],\n]\n\nlayout = [\n \"width\"=>800,\n \"xaxis\"=>[\n \"domain\"=>[0.3,0.7]\n ],\n \"yaxis\"=>[\n \"title\"=> \"yaxis title\",\n \"titlefont\"=>[\n \"color\"=>c[1]\n ],\n \"tickfont\"=>[\n \"color\"=>c[1]\n ],\n ],\n \"yaxis2\"=>[\n \"overlaying\"=>\"y\",\n \"side\"=>\"left\",\n \"anchor\"=>\"free\",\n \"position\"=>0.15,\n \n \"title\"=> \"yaxis2 title\",\n \"titlefont\"=>[\n \"color\"=>c[2]\n ],\n \"tickfont\"=>[\n \"color\"=>c[2]\n ],\n ],\n \"yaxis3\"=>[\n \"overlaying\"=>\"y\",\n \"side\"=>\"left\",\n \"anchor\"=>\"free\",\n \"position\"=>0,\n \n \"title\"=> \"yaxis3 title\",\n \"titlefont\"=>[\n \"color\"=>c[3]\n ],\n \"tickfont\"=>[\n \"color\"=>c[3]\n ],\n ],\n\n \"yaxis4\"=>[ \n \"overlaying\"=>\"y\",\n \"side\"=>\"right\",\n \"anchor\"=>\"x\",\n \n \"title\"=> \"yaxis4 title\",\n \"titlefont\"=>[\n \"color\"=>c[4]\n ],\n \"tickfont\"=>[\n \"color\"=>c[4]\n ], \n ],\n\n \"yaxis5\"=>[ \n \"overlaying\"=>\"y\",\n \"side\"=>\"right\",\n \"anchor\"=>\"free\",\n \"position\"=>0.85,\n\n \"title\"=> \"yaxis5 title\",\n \"titlefont\"=>[\n \"color\"=>c[5]\n ],\n \"tickfont\"=>[\n \"color\"=>c[5]\n ], \n ],\n\n \"yaxis6\"=>[ \n \"overlaying\"=>\"y\",\n \"side\"=>\"right\",\n \"anchor\"=>\"free\",\n \"position\"=>1.0,\n\n \"title\"=> \"yaxis6 title\",\n \"titlefont\"=>[\n \"color\"=>c[6]\n ],\n \"tickfont\"=>[\n \"color\"=>c[6]\n ], \n ],\n \"title\"=> \"multiple y-axes example\"\n]\n\n\n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
46+
"language": "python",
47+
"metadata": {},
48+
"outputs": [
49+
{
50+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/775/700/700' width='750'></iframe>",
51+
"metadata": {},
52+
"output_type": "display_data"
53+
}
54+
],
55+
"prompt_number": 3
56+
},
57+
{
58+
"cell_type": "code",
59+
"collapsed": false,
60+
"input": "data = [\n [\n \"x\"=>[1,2,3],\n \"y\"=>[4,5,6],\n ],\n [\n \"x\"=>[20,30,40],\n \"y\"=>[50,60,70],\n \"xaxis\"=>\"x2\",\n \"yaxis\"=>\"y2\"\n ]\n]\n\nlayout = [\n \"xaxis\"=>[\n \"domain\"=>[0,0.45] # i.e. let the first x-axis span the first 45% of the plot width\n ],\n \"xaxis2\"=>[\n \"domain\"=>[0.55,1] # i.e. let the second x-axis span the latter 45% of the plot width\n ],\n \"yaxis2\"=>[\n \"anchor\"=>\"x2\" # i.e. bind the second y-axis to the start of the second x-axis\n ]\n]\n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
61+
"language": "python",
62+
"metadata": {},
63+
"outputs": [
64+
{
65+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/776/700/700' width='750'></iframe>",
66+
"metadata": {},
67+
"output_type": "display_data"
68+
}
69+
],
70+
"prompt_number": 4
71+
},
72+
{
73+
"cell_type": "code",
74+
"collapsed": false,
75+
"input": "data = [\n [\n \"x\"=>[1,2,3],\n \"y\"=>[4,5,6],\n ],\n [\n \"x\"=>[20,30,40],\n \"y\"=>[50,60,70],\n \"xaxis\"=>\"x2\",\n \"yaxis\"=>\"y2\"\n ]\n]\n\nlayout = [\n \"xaxis\"=>[\n \"domain\"=>[0,0.7] # i.e. let the first x-axis span the first 70% of the plot width\n ],\n \"xaxis2\"=>[\n \"domain\"=>[0.8,1] # i.e. let the second x-axis span the latter 20% of the plot width\n ],\n \"yaxis2\"=>[\n \"anchor\"=>\"x2\" # i.e. bind the second y-axis to the start of the second x-axis\n ]\n]\n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
76+
"language": "python",
77+
"metadata": {},
78+
"outputs": [
79+
{
80+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/777/700/700' width='750'></iframe>",
81+
"metadata": {},
82+
"output_type": "display_data"
83+
}
84+
],
85+
"prompt_number": 5
86+
},
87+
{
88+
"cell_type": "code",
89+
"collapsed": false,
90+
"input": "data = [\n [\n \"x\"=>[1,2,3],\n \"y\"=>[4,5,6],\n ],\n [\n \"x\"=>[20,30,40],\n \"y\"=>[50,60,70],\n \"xaxis\"=>\"x2\",\n \"yaxis\"=>\"y2\"\n ],\n [\n \"x\"=>[300,400,500],\n \"y\"=>[600,700,800],\n \"xaxis\"=>\"x3\",\n \"yaxis\"=>\"y3\"\n ],\n [\n \"x\"=>[4000,5000,6000],\n \"y\"=>[7000,8000,9000],\n \"xaxis\"=>\"x4\",\n \"yaxis\"=>\"y4\"\n ] \n]\n\nlayout = [\n \"xaxis\"=>[\n \"domain\"=>[0,0.45] # let the first x-axis span the first 45% of the plot width\n ],\n \"yaxis\"=>[\n \"domain\"=>[0,0.45] # # and let the first y-axis span the first 45% of the plot height\n ],\n \"xaxis2\"=>[\n \"domain\"=>[0.55,1] # and let the second x-axis span the latter 45% of the plot width\n ],\n \"yaxis2\"=>[\n \"domain\"=>[0,0.45], # and let the second y-axis span the first 45% of the plot height\n \"anchor\"=>\"x2\" # bind the horizontal position of the second y-axis to the start of the second x-axis\n ],\n \"xaxis3\"=>[\n \"domain\"=>[0,0.45],\n \"anchor\"=>\"y3\" # bind the vertical position of this axis to the start of yaxis3\n ],\n \"yaxis3\"=>[\n \"domain\"=>[0.55,1],\n ],\n \"xaxis4\"=>[\n \"domain\"=>[0.55,1],\n \"anchor\"=>\"y4\", # bind the vertical position of this axis to the start of yaxis4\n ],\n \"yaxis4\"=>[\n \"domain\"=>[0.55,1],\n \"anchor\"=>\"x4\" # bind the horizontal position of this axis to the start of xaxis4\n ] \n]\n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
91+
"language": "python",
92+
"metadata": {},
93+
"outputs": [
94+
{
95+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/778/700/700' width='750'></iframe>",
96+
"metadata": {},
97+
"output_type": "display_data"
98+
}
99+
],
100+
"prompt_number": 6
101+
},
102+
{
103+
"cell_type": "code",
104+
"collapsed": false,
105+
"input": "data = [\n [\n \"x\"=>[1,2,3],\n \"y\"=>[2,3,4],\n ],\n [\n \"x\"=>[20,30,40],\n \"y\"=>[5,5,5],\n \"xaxis\"=>\"x2\",\n \"yaxis\"=>\"y\"\n ],\n [\n \"x\"=>[2,3,4],\n \"y\"=>[600,700,800],\n \"xaxis\"=>\"x\",\n \"yaxis\"=>\"y3\"\n ],\n [\n \"x\"=>[4000,5000,6000],\n \"y\"=>[7000,8000,9000],\n \"xaxis\"=>\"x4\",\n \"yaxis\"=>\"y4\"\n ] \n]\n\nlayout = [\n \"xaxis\"=>[\n \"domain\"=>[0,0.45] # let the first x-axis span the first 45% of the plot width\n ],\n \"yaxis\"=>[\n \"domain\"=>[0,0.45] # and let the first y-axis span the first 45% of the plot height\n ],\n \"xaxis2\"=>[\n \"domain\"=>[0.55,1] # and let the second x-axis span the latter 45% of the plot width\n ],\n \"yaxis3\"=>[\n \"domain\"=>[0.55,1],\n ],\n \"xaxis4\"=>[\n \"domain\"=>[0.55,1],\n \"anchor\"=>\"y4\", # bind the vertical position of this axis to the start of yaxis4\n ],\n \"yaxis4\"=>[\n \"domain\"=>[0.55,1],\n \"anchor\"=>\"x4\" # bind the horizontal position of this axis to the start of xaxis4\n ] \n]\n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
106+
"language": "python",
107+
"metadata": {},
108+
"outputs": [
109+
{
110+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/779/700/700' width='750'></iframe>",
111+
"metadata": {},
112+
"output_type": "display_data"
113+
}
114+
],
115+
"prompt_number": 7
116+
},
117+
{
118+
"cell_type": "code",
119+
"collapsed": false,
120+
"input": "data = [\n [\"x\"=> [0,1,2], \"y\"=> [10,11,12]],\n [\"x\"=> [2,3,4], \"y\"=> [100,110,120], \"yaxis\"=> \"y2\", \"xaxis\"=> \"x2\"],\n [\"x\"=> [3,4,5], \"y\"=> [1000,1100,1200], \"yaxis\"=> \"y3\", \"xaxis\"=> \"x3\"]\n]\n\nlayout=[\n \"yaxis\"=> [\"domain\"=> [0,0.8/3.]],\n \"yaxis2\"=> [\"domain\"=>[0.8/3+0.1,2*0.8/3+0.1]],\n \"yaxis3\"=> [\"domain\"=>[2*0.8/3+0.2,1]],\n \"xaxis2\"=> [\"anchor\"=>\"y2\"],\n \"xaxis3\"=> [\"anchor\"=>\"y3\"],\n \"legend\"=> [\"traceorder\"=> \"reversed\"]\n]\n \n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
121+
"language": "python",
122+
"metadata": {},
123+
"outputs": [
124+
{
125+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/780/700/700' width='750'></iframe>",
126+
"metadata": {},
127+
"output_type": "display_data"
128+
}
129+
],
130+
"prompt_number": 8
131+
},
132+
{
133+
"cell_type": "code",
134+
"collapsed": false,
135+
"input": "data = [\n [\"x\"=> [0,1,2], \"y\"=> [10,11,12]],\n [\"x\"=> [2,3,4], \"y\"=> [100,110,120], \"yaxis\"=> \"y2\"],\n [\"x\"=> [3,4,5], \"y\"=> [1000,1100,1200], \"yaxis\"=> \"y3\"]\n]\n\nlayout=[\n \"yaxis\"=> [\"domain\"=> [0,1./3.]],\n \"yaxis2\"=> [\"domain\"=>[1./3,2./3.]],\n \"yaxis3\"=> [\"domain\"=>[2./3.,1]],\n \"legend\"=> [\"traceorder\"=> \"reversed\"]\n]\n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
136+
"language": "python",
137+
"metadata": {},
138+
"outputs": [
139+
{
140+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/781/700/700' width='750'></iframe>",
141+
"metadata": {},
142+
"output_type": "display_data"
143+
}
144+
],
145+
"prompt_number": 9
146+
},
147+
{
148+
"cell_type": "code",
149+
"collapsed": false,
150+
"input": "data = [\n [\n \"x\"=>[1,2,3],\n \"y\"=>[4,3,2],\n ],\n [\n \"x\"=>[20,30,40],\n \"y\"=>[30,40,50],\n \"xaxis\"=>\"x2\",\n \"yaxis\"=>\"y2\"\n ]\n]\nlayout = [\n \"xaxis2\"=> [\n \"domain\"=> [0.6, 0.95],\n \"anchor\"=> \"y2\"\n ],\n \"yaxis2\"=>[\n \"domain\"=> [0.6, 0.95],\n \"anchor\"=> \"x2\"\n ]\n]\n\nresponse = Plotly.plot([data], [\"layout\" => layout])\nurl = response[\"url\"]\nfilename = response[\"filename\"]\n\ns = string(\"<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='\",\n response[\"url\"],\n \"/700/700' width='750'></iframe>\")\ndisplay(\"text/html\", s)",
151+
"language": "python",
152+
"metadata": {},
153+
"outputs": [
154+
{
155+
"html": "<iframe height='750' id='igraph' scrolling='no' seamless='seamless' src='http://plot.ly/~demos/782/700/700' width='750'></iframe>",
156+
"metadata": {},
157+
"output_type": "display_data"
158+
}
159+
],
160+
"prompt_number": 10
161+
},
162+
{
163+
"cell_type": "code",
164+
"collapsed": false,
165+
"input": "",
166+
"language": "python",
167+
"metadata": {},
168+
"outputs": []
169+
}
170+
],
171+
"metadata": {}
172+
}
173+
]
174+
}

0 commit comments

Comments
 (0)