Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotly examples do not work #236

Closed
montyvesselinov opened this issue Oct 1, 2018 · 2 comments
Closed

Plotly examples do not work #236

montyvesselinov opened this issue Oct 1, 2018 · 2 comments

Comments

@montyvesselinov
Copy link

Plotly documentation is not very informative at https://plot.ly/julia/polar-chart

What should be the correct syntax for this:

using Plotly

trace1 = [
  "r" => [77.5, 72.5, 70.0, 45.0, 22.5, 42.5, 40.0, 62.5],
  "t" => ["North", "N-E", "East", "S-E", "South", "S-W", "West", "N-W"],
  "name" => "11-14 m/s",
  "marker" => ["color" => "rgb(106,81,163)"],
  "type" => "area"
]
trace2 = [
  "r" => [57.5, 50.0, 45.0, 35.0, 20.0, 22.5, 37.5, 55.0],
  "t" => ["North", "N-E", "East", "S-E", "South", "S-W", "West", "N-W"],
  "name" => "8-11 m/s",
  "marker" => ["color" => "rgb(158,154,200)"],
  "type" => "area"
]
trace3 = [
  "r" => [40.0, 30.0, 30.0, 35.0, 7.5, 7.5, 32.5, 40.0],
  "t" => ["North", "N-E", "East", "S-E", "South", "S-W", "West", "N-W"],
  "name" => "5-8 m/s",
  "marker" => ["color" => "rgb(203,201,226)"],
  "type" => "area"
]
trace4 = [
  "r" => [20.0, 7.5, 15.0, 22.5, 2.5, 2.5, 12.5, 22.5],
  "t" => ["North", "N-E", "East", "S-E", "South", "S-W", "West", "N-W"],
  "name" => "< 5 m/s",
  "marker" => ["color" => "rgb(242,240,247)"],
  "type" => "area"
]
data = [trace1, trace2, trace3, trace4]
layout = [
  "title" => "Wind Speed Distribution in Laurel, NE",
  "font" => ["size" => 16],
  "legend" => ["font" => ["size" => 16]],
  "radialaxis" => ["ticksuffix" => "%"],
  "orientation" => 270
]
response = Plotly.plot(data, ["layout" => layout, "filename" => "polar-area-chart", "fileopt" => "overwrite"])
plot_url = response["url"]
@sglyon
Copy link
Member

sglyon commented Oct 1, 2018

Hi @montyvesselinov thanks for opening.

Unfortunately the documentation on plotly's website is very out of date.

The correct way to do this in Julia would be

using PlotlyJS
trace1 = area(
  r=[77.5, 72.5, 70.0, 45.0, 22.5, 42.5, 40.0, 62.5],
  t=["North", "N-E", "East", "S-E", "South", "S-W", "West", "N-W"],
  name="11-14 m/s",
  marker_color="rgb(106,81,163)"
)
trace2 = area(
  r=[57.5, 50.0, 45.0, 35.0, 20.0, 22.5, 37.5, 55.0],
  t=["North", "N-E", "East", "S-E", "South", "S-W", "West", "N-W"],
  name="8-11 m/s",
  marker_color="rgb(158,154,200)",
)
trace3 = area(
  r=[40.0, 30.0, 30.0, 35.0, 7.5, 7.5, 32.5, 40.0],
  t=["North", "N-E", "East", "S-E", "South", "S-W", "West", "N-W"],
  name="5-8 m/s",
  marker_color="rgb(203,201,226)",
)
trace4 = area(
  r=[20.0, 7.5, 15.0, 22.5, 2.5, 2.5, 12.5, 22.5],
  t=["North", "N-E", "East", "S-E", "South", "S-W", "West", "N-W"],
  name="< 5 m/s",
  marker_color="rgb(242,240,247)",
)
data = [trace1, trace2, trace3, trace4]
layout = Layout(
  title="Wind Speed Distribution in Laurel, NE",
  font_size=16,
  legend_font_size=16,
  radialaxis_ticksuffix="%",
  orientation=270
)
plot(data, layout)

Please see the documentation for this project (here) for more details and examples.

@sglyon sglyon closed this as completed Oct 1, 2018
@montyvesselinov
Copy link
Author

Thank you very much! this works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants