Skip to content

Commit

Permalink
Merge pull request #4 from plotly/bar_charts_with_different_examples_…
Browse files Browse the repository at this point in the history
…13388529493274

bar marker array example
  • Loading branch information
chriddyp committed Jun 26, 2014
2 parents 66f145c + 4bd2503 commit af3d3ef
Show file tree
Hide file tree
Showing 26 changed files with 1,040 additions and 654 deletions.
17 changes: 17 additions & 0 deletions auto-docs/chart-types/bar/bar-marker-array/julia/code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Plotly

{% if not username %}# Fill in with your personal username and API key
# or, use this public demo account
{% endif %}Plotly.signin({% if username %}"{{username}}"{% else %}"Julia-Demo-Account"{% endif %}, {% if api_key %}"{{api_key}}"{% else %}"hvkrsbg3uj"{% endif %})

data = [
[
"x" => [1, 2, 3, 4],
"y" => [5, 4, -3, 2],
"marker" => ["color" => ["#447adb", "#447adb", "#db5a44", "#447adb"]],
"type" => "bar"
]
]

response = Plotly.plot([data], ["filename" => "bar-marker-array", "fileopt" => "overwrite"])
plot_url = response["url"]
14 changes: 14 additions & 0 deletions auto-docs/chart-types/bar/bar-marker-array/matlab/code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% if not username %}% Fill in with your personal username and API key
% or, use this public demo account
{% endif %}signin({% if username %}'{{username}}'{% else %}'MATLAB-Demo-Account'{% endif %}, {% if api_key %}'{{api_key}}'{% else %}'p42phiifti'{% endif %})

data = {...
struct(...
'x', [1, 2, 3, 4], ...
'y', [5, 4, -3, 2], ...
'marker', struct('color', { {'#447adb', '#447adb', '#db5a44', '#447adb'} }), ...
'type', 'bar')...
};

response = plotly(data, struct('filename', 'bar-marker-array', 'fileopt', 'overwrite'));
plot_url = response.url
17 changes: 17 additions & 0 deletions auto-docs/chart-types/bar/bar-marker-array/nodejs/code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if not username %}// Fill in with your personal username and API key
// or, use this public demo account
{% endif %}var plotly = require('plotly')({% if username %}'{{username}}'{% else %}'Node.js-Demo-Account'{% endif %},{% if api_key %}'{{api_key}}'{% else %}'dvlqkmw0zm'{% endif %});

var data = [
{
x: [1, 2, 3, 4],
y: [5, 4, -3, 2],
marker: {color: ["#447adb", "#447adb", "#db5a44", "#447adb"]},
type: "bar"
}
];

var graph_options = {filename: "bar-marker-array", fileopt: "overwrite"}
plotly.plot(data, graph_options, function (err, msg) {
console.log(msg);
});
18 changes: 18 additions & 0 deletions auto-docs/chart-types/bar/bar-marker-array/python/code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import plotly.plotly as py
from plotly.graph_objs import *

{% if not username %}# Fill in with your personal username and API key
# or, use this public demo account
{% endif %}py.sign_in({% if username %}"{{username}}"{% else %}'Python-Demo-Account'{% endif %}, {% if api_key %}"{{api_key}}"{% else %}'gwt101uhh0'{% endif %})

data = Data([
Bar(
x=[1, 2, 3, 4],
y=[5, 4, -3, 2],
marker=Marker(
color=['#447adb', '#447adb', '#db5a44', '#447adb']
)
)
])

plot_url = py.plot(data, filename='bar-marker-array')
18 changes: 18 additions & 0 deletions auto-docs/chart-types/bar/bar-marker-array/r/code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
library(plotly)

{% if not username %}# Fill in with your personal username and API key
# or, use this public demo account
{% endif %}p <- plotly(username={% if username %}"{{username}}"{% else %}'R-Demo-Account'{% endif %}, key={% if api_key %}"{{api_key}}"{% else %}'yu680v5eii'{% endif %})

data <- list(
list(
x = c(1, 2, 3, 4),
y = c(5, 4, -3, 2),
marker = list(color = c("#447adb", "#447adb", "#db5a44", "#447adb")),
type = "bar"
)
)

response <- p$plotly(data, kwargs=list(filename="bar-marker-array", fileopt="overwrite"))
url <- response$url
filename <- response$filename
16 changes: 16 additions & 0 deletions auto-docs/executables/julia/bar_marker_array.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Plotly

using Plotly
Plotly.signin("TestBot", "r1neazxo9w")

data = [
[
"x" => [1, 2, 3, 4],
"y" => [5, 4, -3, 2],
"marker" => ["color" => ["#447adb", "#447adb", "#db5a44", "#447adb"]],
"type" => "bar"
]
]

response = Plotly.plot([data], ["filename" => "bar-marker-array", "fileopt" => "overwrite", "auto_open" => "false"])
plot_url = response["url"]
12 changes: 12 additions & 0 deletions auto-docs/executables/matlab/bar_marker_array.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
signin('TestBot', 'r1neazxo9w')

data = {...
struct(...
'x', [1, 2, 3, 4], ...
'y', [5, 4, -3, 2], ...
'marker', struct('color', { {'#447adb', '#447adb', '#db5a44', '#447adb'} }), ...
'type', 'bar')...
};

response = plotly(data, struct('filename', 'bar-marker-array', 'fileopt', 'overwrite', 'auto_open', 'false'));
plot_url = response.url
15 changes: 15 additions & 0 deletions auto-docs/executables/nodejs/bar_marker_array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var plotly = require('plotly')('TestBot', 'r1neazxo9w')

var data = [
{
x: [1, 2, 3, 4],
y: [5, 4, -3, 2],
marker: {color: ["#447adb", "#447adb", "#db5a44", "#447adb"]},
type: "bar"
}
];

var graph_options = {filename: "bar-marker-array", fileopt: "overwrite", auto_open: "false"}
plotly.plot(data, graph_options, function (err, msg) {
console.log(msg);
});
16 changes: 16 additions & 0 deletions auto-docs/executables/python/bar_marker_array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import plotly.plotly as py
from plotly.graph_objs import *

py.sign_in('TestBot', 'r1neazxo9w')

data = Data([
Bar(
x=[1, 2, 3, 4],
y=[5, 4, -3, 2],
marker=Marker(
color=['#447adb', '#447adb', '#db5a44', '#447adb']
)
)
])

plot_url = py.plot(data, filename='bar-marker-array', auto_open=False)
16 changes: 16 additions & 0 deletions auto-docs/executables/r/bar_marker_array.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
library(plotly)

p <- plotly(username='TestBot', key='r1neazxo9w')

data <- list(
list(
x = c(1, 2, 3, 4),
y = c(5, 4, -3, 2),
marker = list(color = c("#447adb", "#447adb", "#db5a44", "#447adb")),
type = "bar"
)
)

response <- p$plotly(data, kwargs=list(filename="bar-marker-array", fileopt="overwrite", auto_open="FALSE"))
url <- response$url
filename <- response$filename
10 changes: 10 additions & 0 deletions hard-coded/chart-types/bar/bar-marker-array/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"languages": [
"python",
"nodejs",
"r",
"matlab",
"julia"
],
"name": "Customizing Individual Bar Colors"
}
27 changes: 27 additions & 0 deletions hard-coded/chart-types/bar/bar-marker-array/model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"data": [
{
"x": [
1,
2,
3,
4
],
"y": [
5,
4,
-3,
2
],
"marker": {
"color": [
"#447adb",
"#447adb",
"#db5a44",
"#447adb"
]
},
"type": "bar"
}
]
}
1 change: 1 addition & 0 deletions ids.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"axes-reversed",
"axes-ticks",
"bar-line",
"bar-marker-array",
"basic-area",
"basic-bar",
"basic-box-plot",
Expand Down
17 changes: 17 additions & 0 deletions published/api-docs/chart-types/bar/bar-marker-array/julia/code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Plotly

{% if not username %}# Fill in with your personal username and API key
# or, use this public demo account
{% endif %}Plotly.signin({% if username %}"{{username}}"{% else %}"Julia-Demo-Account"{% endif %}, {% if api_key %}"{{api_key}}"{% else %}"hvkrsbg3uj"{% endif %})

data = [
[
"x" =&gt; [1, 2, 3, 4],
"y" =&gt; [5, 4, -3, 2],
"marker" =&gt; ["color" =&gt; ["#447adb", "#447adb", "#db5a44", "#447adb"]],
"type" =&gt; "bar"
]
]

response = Plotly.plot([data], ["filename" =&gt; "bar-marker-array", "fileopt" =&gt; "overwrite"])
plot_url = response["url"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% if not username %}% Fill in with your personal username and API key
% or, use this public demo account
{% endif %}signin({% if username %}'{{username}}'{% else %}'MATLAB-Demo-Account'{% endif %}, {% if api_key %}'{{api_key}}'{% else %}'p42phiifti'{% endif %})

data = {...
struct(...
'x', [1, 2, 3, 4], ...
'y', [5, 4, -3, 2], ...
'marker', struct('color', { {'#447adb', '#447adb', '#db5a44', '#447adb'} }), ...
'type', 'bar')...
};

response = plotly(data, struct('filename', 'bar-marker-array', 'fileopt', 'overwrite'));
plot_url = response.url
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% if not username %}// Fill in with your personal username and API key
// or, use this public demo account
{% endif %}var plotly = require('plotly')({% if username %}'{{username}}'{% else %}'Node.js-Demo-Account'{% endif %},{% if api_key %}'{{api_key}}'{% else %}'dvlqkmw0zm'{% endif %});

var data = [
{
x: [1, 2, 3, 4],
y: [5, 4, -3, 2],
marker: {color: ["#447adb", "#447adb", "#db5a44", "#447adb"]},
type: "bar"
}
];

var graph_options = {filename: "bar-marker-array", fileopt: "overwrite"}
plotly.plot(data, graph_options, function (err, msg) {
console.log(msg);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import plotly.plotly as py
from plotly.graph_objs import *

{% if not username %}# Fill in with your personal username and API key
# or, use this public demo account
{% endif %}py.sign_in({% if username %}"{{username}}"{% else %}'Python-Demo-Account'{% endif %}, {% if api_key %}"{{api_key}}"{% else %}'gwt101uhh0'{% endif %})

data = Data([
Bar(
x=[1, 2, 3, 4],
y=[5, 4, -3, 2],
marker=Marker(
color=['#447adb', '#447adb', '#db5a44', '#447adb']
)
)
])

plot_url = py.plot(data, filename='bar-marker-array')
18 changes: 18 additions & 0 deletions published/api-docs/chart-types/bar/bar-marker-array/r/code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
library(plotly)

{% if not username %}# Fill in with your personal username and API key
# or, use this public demo account
{% endif %}p &lt;- plotly(username={% if username %}"{{username}}"{% else %}'R-Demo-Account'{% endif %}, key={% if api_key %}"{{api_key}}"{% else %}'yu680v5eii'{% endif %})

data &lt;- list(
list(
x = c(1, 2, 3, 4),
y = c(5, 4, -3, 2),
marker = list(color = c("#447adb", "#447adb", "#db5a44", "#447adb")),
type = "bar"
)
)

response &lt;- p$plotly(data, kwargs=list(filename="bar-marker-array", fileopt="overwrite"))
url &lt;- response$url
filename &lt;- response$filename
15 changes: 15 additions & 0 deletions published/api-docs/references/julia.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@
],
"type": "model",
"id": "style-bar"
},
{
"code": "chart-types/bar/bar-marker-array/julia/code.txt",
"name": "Customizing Individual Bar Colors",
"parent": "bar",
"url": "https://plot.ly/~PlotBot/177",
"languages": [
"python",
"nodejs",
"r",
"matlab",
"julia"
],
"type": "model",
"id": "bar-marker-array"
}
],
"description": "How to make a bar chart in {language}. {num_examples} examples of grouped, stacked, overlaid, and colored bar charts.",
Expand Down
Loading

0 comments on commit af3d3ef

Please sign in to comment.