You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* copy paste PlotlyX over here
* wip
* update project.toml
* change generate_traces.jl and add a schema object
* update artifacts
* rework traces
* bye bye Julai 1.6
* wip trace
* add plot, which is way smarter than auto-generated trace functions
* new readme
* readme
* add save, some readme stuff
* readme
* readme and bump version
Copy file name to clipboardExpand all lines: README.md
+56-93Lines changed: 56 additions & 93 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,26 +7,23 @@
7
7
8
8
<br><br>
9
9
10
-
# Features
10
+
## ✨ Features
11
11
12
12
- 🚀 Fastest time-to-first-plot in Julia!
13
13
- 🌐 Use the [Plotly.js Javascript documentation](https://plotly.com/javascript/) directly. No magic syntax: Just [`JSON3.write`](https://github.com/quinnj/JSON3.jl).
14
-
- Set deeply-nested keys easily with [`EasyConfig.jl`](https://github.com/joshday/EasyConfig.jl).
15
-
- e.g. `myplot.layout.xaxis.title.font.family = "Arial"`
16
-
- 🕸️ Plays nicely with [Cobweb.jl](https://github.com/joshday/Cobweb.jl) to display or save plots as HTML.
17
-
- 🎈 Plots will appear in `MIME"text/html"` environments (like [Pluto.jl](https://github.com/fonsp/Pluto.jl)).
14
+
- 📂 Set deeply-nested keys easily, e.g. `myplot.layout.xaxis.title.font.family = "Arial"`.
18
15
- 📊 The Same [built-in themes](https://plotly.com/python/templates/) as Plotly's python package.
19
16
20
17
<br><br>
21
18
22
-
# 🚀 Quickstart
19
+
##🚀 Quickstart
23
20
24
21
```julia
25
22
using PlotlyLight
26
23
27
-
Preset.Template.plotly_dark!() # Change template
24
+
preset.template.plotly_dark!() # Change template
28
25
29
-
p =Plot(x =1:20, y =cumsum(randn(20)), type="scatter", mode="lines+markers") # Make plot
26
+
p =plot(x =1:20, y =cumsum(randn(20)), type="scatter", mode="lines+markers") # Make plot
30
27
31
28
p.layout.title.text ="My Title!"# Make changes
32
29
@@ -38,133 +35,99 @@ p # `display(p)` to see the updated plot
**You can chain the dot syntax to add traces to a plot, e.g.**
78
64
79
65
```julia
80
-
Plot(data, layout=Config(), config=Config())
81
-
Plot(;layout=Config(), config=Config(), kw...)
66
+
y =randn(20)
67
+
68
+
plot.bar(; y).scatter(; y)
82
69
```
83
70
84
-
Create a Plotly plot with the given `data` (`Config` or `Vector{Config}`), `layout`, and `config`.
85
-
Alternatively, you can create a plot with a single trace by providing the `data` as keyword arguments.
71
+
<br><br>
86
72
87
-
For more info, read the Plotly.js docs: [https://plotly.com/javascript/](https://plotly.com/javascript/).
73
+
## 📄 Saving Plots
88
74
89
-
### Examples
75
+
### Saving Plots As HTML
90
76
91
77
```julia
92
-
p =Plot(Config(x=1:10, y=randn(10)))
78
+
p =plot(y=rand(10))
93
79
94
-
p =Plot(; x=1:10, y=randn(10))
80
+
PlotlyLight.save(p, "myplot.html")
95
81
```
96
82
97
-
<br><br>
83
+
- Note: call `preset.source.standalone!()` first if you want the html file to contain the entire plotly.js script. This enables you to view the plot even without internet access.
98
84
99
-
# ⚙️ Presets and Settings
100
85
101
-
- There are several presets that can make your life easier, located in the `Preset` module.
102
-
- Each preset is a function that you set via `Preset.[Template|Source|PlotContainer].<preset!>`
86
+
### Save Plots as Image via [PlotlyKaleido.jl](https://github.com/JuliaPlots/PlotlyKaleido.jl)
- How the Plotly.js library gets loaded when the plot is displayed in a browser.
102
+
### Theme Presets
103
+
104
+
Set a theme/template via `preset.template.<option>!()`. Note that options are tab-autocomplete-able. These are borrowed from the [built-in themes](https://plotly.com/python/templates/) in the plotly python package.
127
105
128
106
```julia
129
-
cdn! # Use https://cdn.plot.ly/plotly-<version>.min.js to load Plotly.js.
130
-
local! # Use a local copy of Plotly.
131
-
none! # Do not load Plotly.js
132
-
standalone! # Create a standalone html file that hard-codes Plotly.js into it.
107
+
preset.template.ggplot2!()
133
108
```
134
109
135
-
##`Preset.PlotContainer`
110
+
### Source Presets
136
111
137
-
- The HTML `<div>` that the plot will be inserted into.
112
+
Change how the plotly.js script gets loaded in the produced html via `preset.source.<option>!()`.
138
113
139
114
```julia
140
-
auto! # Automatically choose one of the above based on `stdout`.
141
-
fillwindow! # Fill the height/width of the page (REPL default).
142
-
iframe! # Wrap the Plot inside an <iframe> (Jupyter[lab] default).
143
-
pluto! # Use the full width of a Pluto cell (Pluto default).
144
-
responsive! # Fill whatever container the plot lives in.
115
+
preset.source.none!() # Don't include the script.
116
+
preset.source.cdn!() # Use the official plotly.js CDN.
117
+
preset.source.local!() # Use a local version of the plotly.js script.
118
+
preset.source.standalone!() # Copy-paste the plotly.js script into the html output.
145
119
```
146
120
147
-
## Manual Settings
148
-
149
-
If the available `Preset`s aren't enough to satisfy your use case, you can override the settings to your own preferences via the `settings!(; kw...)` function.
150
-
151
-
-`load_plotlyjs`
152
-
- A function that returns a `MIME("text/html")`-representable object that will load the Plotly.js library.
0 commit comments