Giter Club home page Giter Club logo

plotlylight.jl's Introduction

Build status Codecov

PlotlyLight

PlotlyLight is an ultra-lightweight interface for working with Plotly.js.



โœจ Features

  • ๐Ÿš€ Fastest time-to-first-plot in Julia!
  • ๐ŸŒ Use the Plotly.js Javascript documentation directly. No magic syntax: Just JSON3.write.
  • ๐Ÿ“‚ Set deeply-nested keys easily, e.g. myplot.layout.xaxis.title.font.family = "Arial".
  • ๐Ÿ“Š The Same built-in themes as Plotly's python package.



๐Ÿš€ Quickstart

using PlotlyLight

preset.template.plotly_dark!()  # Change template

p = plot(x = 1:20, y = cumsum(randn(20)), type="scatter", mode="lines+markers")  # Make plot

p.layout.title.text = "My Title!"  # Make changes

p  # `display(p)` to see the updated plot

plotlylight.jl's People

Contributors

andreaskroepelin avatar joshday avatar kwatmdphd avatar titas22 avatar zsz00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

plotlylight.jl's Issues

Option to specify default browser to display PlotlyLight.Plot() output

First of all, thank you for the nice package!
Here is my question:
How can I specify the default browser to display PlotlyLight.Plot() output?

For PlotlyJS.jl this can be achieved via the following lines in startup.jl

# --- redefine default browser for PlotlyJS: ---------------------------------------------------------------------------
using PlotlyJS
import PlotlyJS: PlotlyBase.launch_browser
launch_browser(tmppath::String) = run(`cmd /c start msedge.exe $tmppath`)

What would be the equivalent for PlotlyLight?

Downloading Plotly.js error

This is new (wit Julia 1.9.0 and 1.9.2):

[ Info: PlotlyLight: Downloading Plotly.js v2.24.3                                                                                                                                                                                 
ERROR: LoadError: InitError: RequestError: HTTP/1.1 403 Forbidden while requesting https://cdn.plot.ly/plotly-2.24.3.min.js      

Plots in VSCode Jupyter notebook opens in browser instead of below cell

Hi,

I'm trying to use the example plot script, however I end up with the plot opening up in the browser instead of below the cell in Jupyter notebook in VSCode.

using PlotlyLight

p = Plot(x = 1:20, y = cumsum(randn(20)), type="scatter", mode="lines+markers")  # Make plot

display(p)

The output of that is:

Process(`'C:\WINDOWS\system32\cmd.exe' /c start '%USERPROFILE%\.julia\scratchspaces\ec354790-cf28-43e8-bb59-b484409b7bad\CobWeb\index.html'`, ProcessRunning)

Running the same code in REPL creates the plot in a window withing VSCode which is how I would expect it to behave.

I'm running on Windows:
Julia v1.9.0
VSCode v1.82.3
PlotlyLight v0.7.4

New tab for each plot

Is it possible to have the plots show up in new tabs when displaying from a notebook? As it is now each new plot overwrites existing. I am on Apple silicon and running from VSCode notebook interface, if that matters.

VSCode Notebook - opens browser instead of cell rendering

If I run the Quickstart example from your README in a VSCode notebook directly (ipynb), it opens a html file in the local webbrowser instead of rendering it inside the cell as output (file:///home/XXXXXX/.julia/scratchspaces/ec354790-cf28-43e8-bb59-b484409b7bad/CobWeb/index.html).

Any idea why? I suppose this is not the expected behaviour? I would expect the chart to get rendered inside the notebook in the cell output by default without any special configuration.

Using VSCode 1.78.2 on Ubuntu 22.04 with extension Jupyter Notebook Renderers v1.0.15 installed. Julia 1.9.0.

Otherwise, love the idea of having a slim interface using the JavaScript API of Plotly! This should give the best performance and little maintenance required form the package side.

`SETTINGS.layout` gets mutated during plotting

It seems that sometimes the process of merging together a plot layout and the global layout is mutating the global layout.

To reproduce:

PlotlyLight.reset!()
Preset.PlotContainer.settings!(
    layout=Config(xaxis=Config(automargin=true)))
expected_layout = Config(xaxis=Config(automargin=true))
PlotlyLight.SETTINGS.layout == expected_layout # true
Plot(x=rand(10),y=rand(10),layout=Config(
    xaxis=Config(
        title=Config(
            text="myX"))))
PlotlyLight.SETTINGS.layout == expected_layout # no longer true

At the end, the SETTINGS.layout has acquired the xaxis.title.text field

Display in vscode

PlotlyLight.jl is great!

Can I display figures directly in vscode interactively instead of opening the browser?

No plot shows up

On windows. PlotlyLight v0.6.2:

When I plot, a command window opens up with this message:
image

When I look at the mentioned file with a web browser, there is an actual plot:
image

I expected the plot to open in a browser by default.

Missing NaN support

When trying to plot data containing NaN values, there's an error about those not being allowed in JSON spec

using PlotlyLight

p(x=0:11, y=[randn(5); NaN; randn(5)])

Error:

NaN not allowed to be written in JSON spec

Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] #write#90
    @ C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:283 [inlined]
  [3] write
    @ C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:282 [inlined]
  [4] write(::StructTypes.ArrayType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Vector{Float64}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JSON3 C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:187
  [5] write(::StructTypes.ArrayType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Vector{Float64})
    @ JSON3 C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:181
  [6] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Config; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JSON3 C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:157
  [7] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Config)
    @ JSON3 C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:147
  [8] write(::StructTypes.ArrayType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Vector{Config}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JSON3 C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:187
  [9] write
    @ C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:181 [inlined]
 [10] write(io::IOBuffer, obj::Vector{Config}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ JSON3 C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:33
 [11] write
    @ C:\Users\tbucelis\.julia\packages\JSON3\L8Yfy\src\write.jl:30 [inlined]

Support nested NamedTuple

Instead of

p.layout.xaxis = (
    type = "log",
    dtick = log10(2),
    title = "xaxis"
)
p.layout.yaxis = (
    type = "log",
    dtick = 1,
    title = "yaxis"
)

Would it be possible to do

p.layout = (
    xaxis = (
        type = "log",
        dtick = log10(2),
        title = "xaxis"
    ),
    yaxis = (
        type = "log",
        dtick = 1,
        title = "yaxis"
    )
)

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Creating stacked plots

It's not clear how to create stacks of plots:

https://plotly.com/javascript/subplots/

I tried passing a vector of plots, like:

    p1 = Plot(x=1:20, y=cumsum(randn(20)), type="scatter", mode="lines+markers")
    p2 = Plot(x=1:20, y=cumsum(randn(20)), type="scatter", mode="lines+markers")
    p = Plot([p1, p2], Config(; width=800, height=600))

but I get the error:

ERROR: MethodError: no method matching Plot(::Vector{Plot}, ::Config)

I next tried stacking the data:

    p1 = Plot(; x=1:20, y=cumsum(randn(20)), type="scatter", mode="lines+markers")
    p2 = Plot(; x=1:20, y=cumsum(randn(20)), type="scatter", mode="lines+markers")
    p = Plot(first.([p1.data, p2.data]), Config(; width=800, height=600))

But this resulted in both traces being placed in the same plot:

image

I next tried defining a grid in the config:

    p1 = Plot(; x=1:20, y=cumsum(randn(20)), type="scatter", mode="lines+markers")
    p2 = Plot(; x=1:20, y=cumsum(randn(20)), type="scatter", mode="lines+markers")
    p = Plot(
        [p1.data, p2.data],
        Config(; width=800, height=600, grid=(rows=2, columns=1, pattern="independent")),
    )

but this resulted in the second panel being left empty.

Any idea how I could set this up? It could be nice to have a Vector{Plot} function.

Documenter Docs

README is getting unruly and we could use some proper documentation.

UndefVarError: `Plot` not defined

Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
  JULIA_SSL_CA_ROOTS_PATH =

or

Julia Version 1.9.0
Commit 8e63055292 (2023-05-07 11:25 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 ร— Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 1 on 8 virtual cores
Environment:
  JULIA_SSL_CA_ROOTS_PATH =

The following fails on: JuliaLTS, v1.8.5 & v1.9.0:

using PlotlyLight
# Change template
PlotlyLight.template!("plotly_dark")
# Make plot
p = Plot(x = 1:20, y = cumsum(randn(20)), type="scatter", mode="lines+markers"); # this fails
# --- this works fine:
# p = PlotlyLight.Plot(x = 1:20, y = cumsum(randn(20)), type="scatter", mode="lines+markers");

The error message is:

WARNING: both PlotlyLight and PlotlyJS export "Plot"; uses of it in module Main must be qualified
ERROR: LoadError: UndefVarError: `Plot` not defined
Stacktrace:
 [1] top-level scope
   @ C:\data\git_repos\hycenta_stefan_pofahl\julia_scripts\examples\plotting\PlotlyLight\example_HelloWorld_PlotlyLight.jl:7
 [2] include(fname::String)
   @ Base.MainInclude .\client.jl:478
 [3] top-level scope
   @ REPL[1]:1
in expression starting at C:\data\git_repos\hycenta_stefan_pofahl\julia_scripts\examples\plotting\PlotlyLight\example_HelloWorld_PlotlyLight.jl:7

Dark theme issue

Working around #4, with display, I am able to plot :)

Screen Shot 2022-02-10 at 09 37 58

However plotly_dark seems to not work

Screen Shot 2022-02-10 at 09 38 03

What am I doing wrong?

Issues with traces types that accepts matrices as inputs

Some plotly trace types accepts input data in matrix format and the behavior of the trace changes whether the data is specified as a matrix or as a play 1D vector.

The issue comes from the serialization of JSON3 that by defaults serializes any ND-Array as its 1D content.

This can create issues that are different depending on the specific trace affected. I could identify the following problems in these traces, with some details in the examples below:

  • heatmap
  • surface
  • contour

Heatmap Example

The heatmap trace can accept the z values as a matrix, in which case the x and y values can be provided as the vectors generating the underlying grid.
If z is provided as a vector, x and y also has to be provided as 1D vectors containing the x/y values of each single point in z.
This creates an issue when trying to provide z as matrix and x,y as generating vectors in PlolyLight:

image

Surface Example

A different problem happens in surface still when trying to provide x and y as generating vectors, where no Plot is produced with PlotlyLight:

image

Contour Example

Finally, something very weird that I don't understand happens with contour. The plot is rendered but the resulting contour is not the correct one:

image

Can it run in Android's Termux's Ubuntu?

(@v1.7) pkg> test PlotlyLight
...
Progress [====================================  โœ— DefaultApplication
  โœ— Cobweb
  โœ— PlotlyLight
  0 dependencies successfully precompiled in 21 seconds (9 already precompiled)
  3 dependencies errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the packages
     Testing Running tests...
ERROR: LoadError: IOError: stat("/proc/sys/kernel/osrelease"): permission denied (EACCES)
Stacktrace:
  [1] uv_error
    @ ./libuv.jl:97 [inlined]
  [2] stat(path::String)
    @ Base.Filesystem ./stat.jl:152
  [3] isfile(path::String)
    @ Base.Filesystem ./stat.jl:456
  [4] top-level scope
    @ ~/.julia/packages/DefaultApplication/7wyMn/src/DefaultApplication.jl:8
  [5] include
    @ ./Base.jl:418 [inlined]
  [6] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1318
  [7] top-level scope
    @ none:1
  [8] eval
    @ ./boot.jl:373 [inlined]
  [9] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [10] top-level scope
    @ none:1
in expression starting at /root/.julia/packages/DefaultApplication/7wyMn/src/DefaultApplication.jl:1
ERROR: LoadError: Failed to precompile DefaultApplication [3f0dd361-4fe0-5fc6-8523-80b14ec94d85] to /root/.julia/compiled/v1.7/DefaultApplication/jl_XtyYHr.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include
    @ ./Base.jl:418 [inlined]
  [8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1318
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:373 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [12] top-level scope
    @ none:1
in expression starting at /root/.julia/packages/Cobweb/AR1Ub/src/Cobweb.jl:1
ERROR: LoadError: Failed to precompile Cobweb [ec354790-cf28-43e8-bb59-b484409b7bad] to /root/.julia/compiled/v1.7/Cobweb/jl_xar3DG.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include
    @ ./Base.jl:418 [inlined]
  [8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1318
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:373 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [12] top-level scope
    @ none:1
in expression starting at /root/.julia/packages/PlotlyLight/xV2L1/src/PlotlyLight.jl:1
ERROR: LoadError: Failed to precompile PlotlyLight [ca7969ec-10b3-423e-8d99-40f33abb42bf] to /root/.julia/compiled/v1.7/PlotlyLight/jl_5RKypZ.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1466
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1410
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1120
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1013
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:997
 [7] include(fname::String)
   @ Base.MainInclude ./client.jl:451
 [8] top-level scope
   @ none:6
in expression starting at /root/.julia/packages/PlotlyLight/xV2L1/test/runtests.jl:1
ERROR: Package PlotlyLight errored during testing
(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [1b08a953] Dash v1.1.2
  [1b08a953] DashBootstrapComponents v1.1.0
  [682c06a0] JSON v0.21.3
  [9b87118b] PackageCompiler v2.0.6
  [f0f68f2c] PlotlyJS v0.18.8
  [ca7969ec] PlotlyLight v0.5.0
  [37e2e46d] LinearAlgebra
julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (aarch64-unknown-linux-gnu)
ERROR: IOError: uv_cpu_info: permission denied (EACCES)
Stacktrace:
 [1] uv_error
   @ ./libuv.jl:97 [inlined]
 [2] cpu_info()
   @ Base.Sys ./sysinfo.jl:216
 [3] versioninfo(io::Base.TTY; verbose::Bool)
   @ InteractiveUtils ~/julia-1.7.2/share/julia/stdlib/v1.7/InteractiveUtils/src/InteractiveUtils.jl:123
 [4] versioninfo(io::Base.TTY) (repeats 2 times)
   @ InteractiveUtils ~/julia-1.7.2/share/julia/stdlib/v1.7/InteractiveUtils/src/InteractiveUtils.jl:88
 [5] top-level scope
   @ REPL[9]:1

Usage of "legendgroup" inside PlotlyLight

Below a PlotlyJS example with one legendgroup per sub-plot.
Unfortunately, the code prevents to toggle visibility of single traces.
Do you know how arrange this functionality in PlotlyLight?

using PlotlyJS

function _legend_groups()
    # ---
    # --- create object containing sub-plots():
    _fig_obj = PlotlyJS.make_subplots(
        rows = 1, cols = 2,
    #           column 1    column 2
        specs = [ Spec()    Spec()], # raw 1
        )
    # --- read vector of standard colors "colorway":
    _colorway = PlotlyJS.PlotlyBase._get_colorway(_fig_obj.plot) # we must take the field ".plot"
    # ---
    _fig_layout = PlotlyJS.Layout(;
        title_text       = "Legend Groups",
        xaxis_title_text = "time / s",
        yaxis_title_text = "Amplitude",
        yaxis_range      = [0, 4],
        yaxis2 = PlotlyJS.attr(
            title       = "Amplitude",
            overlaying  = "y",
            side        = "left",
            range       = [0, 4],
            scaleanchor = "y",
            scaleratio  = 1,
        ),
        xaxis2_title_text = "time / s",
    )
    # ---
    for i_segment = 1 : 3
        if i_segment == 1
            PlotlyJS.add_trace!(_fig_obj, PlotlyJS.scatter(; y = i_segment .* ones(4), 
                line_color = _colorway[i_segment], 
                legendgroup = "group1", legendgrouptitle_text="First Group Title", ), row = 1, col =1)            
            PlotlyJS.add_trace!(_fig_obj, PlotlyJS.scatter(; y = 1.1 * i_segment .* ones(4), 
                line_color = _colorway[i_segment], 
                legendgroup = "group2", legendgrouptitle_text="Second Group Title", ), row = 1, col =2)            
        else
            PlotlyJS.add_trace!(_fig_obj, PlotlyJS.scatter(; y = i_segment .* ones(4), 
                line_color = _colorway[i_segment], legendgroup = "group1", ), row = 1, col =1)            
            PlotlyJS.add_trace!(_fig_obj, PlotlyJS.scatter(; y = 0.5 * i_segment .* ones(4), 
                line_color = _colorway[i_segment], legendgroup = "group2", ), row = 1, col = 2)
        end
    end
    # ---        
    PlotlyJS.relayout!(_fig_obj.plot, _fig_layout) # only re-layout the field ".plot"
    return _fig_obj
end

display(_legend_groups().plot)

Modifying attributes of a trace

Would it make sense to allow the plot to accept a Config argument? To accommodate for instance

t = PlotlyLight.Config(x = nths, y = y)
        t.name = "$(version)"
        t.mode = "markers+lines"
        t.marker = Config(symbol = "square", size = 12)
p(t) # instead of: push!(p.data, t)

plolty version

Hello!

Very cool package for minimizing TTF plot!
I have been playing around a lot with plotly and also started working recently on wrapping around PlotlyBase.jl to optimize plotting in Pluto with plolty (https://github.com/JuliaPluto/PlutoPlotly.jl)

I might consider using your package instead of PlotlyBase.jl as base, or even try to see if I can get to add some Pluto-specific optimizations as PR to this if the concept is OK with you and they are light enough!

Apart from this introduction, I was going through your code and noticed that at least for the CDN show option which is the default, you are pointing to plotly-latest for the plotly version.
I do not know if this was a deliberate choice to keep the library to version 1, but since plotly moved to version 2, one has to manually specify the version number and plolty-latest will always point to the last revision of version 1, as written here:
https://github.com/plotly/plotly.js#un-minified-versions-are-also-available-on-cdn

Please note that as of v2 the "plotly-latest" outputs (e.g. https://cdn.plot.ly/plotly-latest.min.js) will no longer be updated on the CDN, and will stay at the last v1 patch v1.58.5. Therefore, to use the CDN with plotly.js v2 and higher, you must specify an exact plotly.js version.

Would it be difficult to add some config parameter to also specify the plotly version to load? As quite a few fixes and features addition have happened since 1.58.5

referring to columns of a dataframe

When data refer to columns of a dataframe, life would be a little easier if no need to type the dataframe's name like in PlotlyBase. E.g.

# dfwithlongname::DataFrame has columns like n, open, high, low, and close etc.
# using PlotlyJS
# candlestick(dfwithlongname, x=:n, open=:open, high=:high, low=:low, close=:close, text=:dt)
using PlotlyLight
data = Config(x=dfwithlongname.n, open=dfwithlongname.open, high=dfwithlongname.high, low=dfwithlongname.low, close=dfwithlongname.close, text=dfwithlongname.dt, type="candlestick")

Thanks.

Unicode text isn't shown correctly with long series

Unicode text in axis title or legend isn't shown correctly with long series. For example, the yaxis title isn't rendered correctly with the code below.

Plot(
    Config(y=rand(20000)),
    Config(
        yaxis=Config(title="Hโ‚‚ ฮท ฯ")
    )
)

image

I tried similar plots with Plotly.js directly and it worked, so it doesn't seem like an upstream issue.

Plotly.newPlot('graph', [{
  y: Array.from({length: 100000}, () => Math.random()),
}],{
  yaxis: {
    title: "Hโ‚‚ ฮท ฯ"
  }
})

image

calling `JSON.json` on a PlotlyLight Plot causes stackoverflow

I stumbled upon this issues because of failing tests in PlotlyKaleido in the last days.

With version 0.8 of PlotlyLight, one can't seem to call JSON.json on the object without causing an error:

julia> using PlotlyLight, JSON

julia> p = Plot(Config(x = rand(10)));

julia> json(p)
ERROR: StackOverflowError:
Stacktrace:
  [1] Array
    @ .\boot.jl:477 [inlined]
  [2] Array
    @ .\boot.jl:486 [inlined]
  [3] Array
    @ .\boot.jl:494 [inlined]
  [4] _collect_indices
    @ .\array.jl:777 [inlined]
  [5] collect
    @ .\array.jl:761 [inlined]
  [6] JSON.Writer.CompositeTypeWrapper(x::Plot, syms::Vector{Any}) (repeats 74610 times)
    @ JSON.Writer C:\Users\Alberto.Mengali\.julia\packages\JSON\93Ea8\src\Writer.jl:22
  [7] JSON.Writer.CompositeTypeWrapper(x::Plot)
    @ JSON.Writer C:\Users\Alberto.Mengali\.julia\packages\JSON\93Ea8\src\Writer.jl:23
  [8] lower
    @ C:\Users\Alberto.Mengali\.julia\packages\JSON\93Ea8\src\Writer.jl:45 [inlined]
  [9] show_json
    @ C:\Users\Alberto.Mengali\.julia\packages\JSON\93Ea8\src\Writer.jl:348 [inlined]
 [10] #show_json#9
    @ C:\Users\Alberto.Mengali\.julia\packages\JSON\93Ea8\src\Writer.jl:359 [inlined]
 [11] show_json
    @ C:\Users\Alberto.Mengali\.julia\packages\JSON\93Ea8\src\Writer.jl:357 [inlined]
 [12] print(io::IOBuffer, obj::Plot)
    @ JSON.Writer C:\Users\Alberto.Mengali\.julia\packages\JSON\93Ea8\src\Writer.jl:383
 [13] sprint(f::Function, args::Plot; context::Nothing, sizehint::Int64)
    @ Base .\strings\io.jl:114
 [14] sprint
    @ .\strings\io.jl:107 [inlined]
 [15] json(a::Plot)
    @ JSON.Writer C:\Users\Alberto.Mengali\.julia\packages\JSON\93Ea8\src\Writer.jl:399

This does not happen with version 0.7 of PlotlyLight

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.