-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy path2015-05-25-getting-started_julia_index.html
executable file
·123 lines (97 loc) · 4.03 KB
/
2015-05-25-getting-started_julia_index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
name: Getting Started with Plotly
permalink: julia/getting-started/
description: Plotly's Julia graphing library makes interactive, publication-quality graphs online. Examples of how to make line plots, scatter plots, area charts, bar charts, error bars, box plots, histograms, heatmaps, subplots, multiple-axes, polar charts and bubble charts.
layout: base
language: julia
---
<h1>Getting started: Plotly for Julia</h1>
<section class="section">
<h2 >Installation</h2>
<div class="content-box">
<p >
Install using Julia's <code class="no-padding">Pkg</code> module. From the Julia REPL:
</p>
<pre><code>Pkg.add("Plotly")</code></pre>
</div>
</section>
<section class="section">
<h2 >Initialization</h2>
<div class="content-box">
<p >
In the Julia console, begin by importing the Plotly Julia library.
</p>
<pre><code>using Plotly</code></pre>
</div>
</section>
<section class="section">
<h2 >Authentication</h2>
<div class="content-box">
<p >
Next, set your Plotly user credentials.
</p>
<p >
It is also possible to save your user credentials for future Julia sessions. In your Julia terminal, enter:
<pre><code>Plotly.set_credentials_file({"username"=>"DemoAccount","api_key"=>"lr1c37zw81"})</code></pre>
</p>
<p >
You'll need to replace <code class="no-padding">"DemoAccount"</code> and <code class="no-padding">"lr1c37zw81"</code> with your Plotly username and <a href="https://plotly.com/settings/api/" target="_blank">API key</a>.
</p>
<p >
<a href="https://plotly.com/settings/api/" target="_blank">Find my API key.</a>
</p>
<p >
You only have to set this up if it's your first time using a Plotly API.
</p>
<h6>
Special Instructions for <a class="no_underline" href="https://plotly.com/product/enterprise/">Chart Studio Enterprise</a> users
</h6>
<p>
If your company has a Chart Studio Enterprise server, change the API endpoint so that it points to your company's Plotly server instead of Plotly's cloud.
</p>
<p>In your Julia console, enter:<p>
<br>
<pre><code class="julia">Plotly.set_config_file({"plotly_domain"=>"https://plotly.your-company.com", "plotly_api_domain"=>"https://api-plotly.your-company.com"})</code></pre>
<br>
<p>
Make sure to replace "your-company.com" with the URL of your Chart Studio Enterprise server.<b>Questions? <a href="mailto:[email protected]">[email protected]</a></b>
</p>
</div>
</section>
<section class="section">
<h2 >Start plotting!</h2>
<div class="content-box">
<p >
Now you can make a simple API call using <code class="no-padding">Plotly.plot()</code>, and create your first graph!
</p>
<pre><code>trace1 = [
"x" => [1, 2, 3, 4],
"y" => [10, 15, 13, 17],
"type" => "scatter"
]
trace2 = [
"x" => [1, 2, 3, 4],
"y" => [16, 5, 11, 9],
"type" => "scatter"
]
response = Plotly.plot([trace1, trace2], ["filename" => "basic-line", "fileopt" => "overwrite"])
plot_url = response["url"]</code></pre>
</div>
</section>
<section class="section">
<h2 >Response</h2>
<div class="content-box">
<p >
Here is the response you'll receive (copy and paste the URL into your browser to see your graph!)
</p>
<pre><code>["url"=>"http://plot.ly/~username/888",
"filename"=>"filename",
"error"=>"",
"message"=>"",
"warning"=>""]</code></pre>
</div>
</section>
{% include posts/credentials.html %}
<div class="row centered btnrow">
<a href="/julia/" class="button no_underline">VIEW EXAMPLES</a><br>
</div>