Data

R

p <- plot_ly(
  type = 'contour',
  z = matrix(c( 6.0000, -1.0000, -1.0000, -1.0000, -1.0000, -1.0000, -1.0000, -1.0000, 
                0.2780,  1.0000,  0.8770, -0.8240, -1.0000, -0.9050,  0.1450,  0.9770, 
               -0.5120, 0.1340, -0.3430, -0.7960, -1.0000, -1.0000, -1.0000, -1.0000), nrow = 3, ncol = 8),
  contours = list(
    coloring = 'heatmap'
  )
)
p
# Create a shareable link to your chart
# Set up API credentials: https://plot.ly/r/getting-started
#'@ Sys.setenv("plotly_username"="englianhu")
#'@ Sys.setenv("plotly_api_key"="7gZsXKhH0hmqy0fXgyGH")
#'@ chart_link = api_create(p, filename = 'sample1')
#'@ chart_link

Python

import plotly
import plotly.plotly as py
from plotly.graph_objs import *
import matplotlib.pyplot as plt
#'@ import numpy as npplotly.tools.set_credentials_file(username='englianhu', api_key='7gZsXKhH0hmqy0fXgyGH')

data = Data([
    Contour(
        z=[[6.0000, -1.0000, -1.0000, -1.0000, -1.0000, -1.0000, -1.0000, -1.0000], 
           [0.2780,  1.0000,  0.8770, -0.8240, -1.0000, -0.9050,  0.1450,  0.9770], 
           [-0.5120, 0.1340, -0.3430, -0.7960, -1.0000, -1.0000, -1.0000, -1.0000]]
    )])
#'@ py.iplot(data)
#'@ plotly.offline.iplot(data)
#'@ plt.show(data)
#'@ py.plot(data, filename = 'sample2')
py.iplot(data, filename = 'sample2')

Coding

https://plot.ly/~englianhu/149/#code

JSON

{
  "data": [
    {
      "zsrc": "englianhu:150:",
      "z": [
        [
          6,
          -1,
          -1,
          -1,
          -1,
          -1,
          -1,
          -1
        ],
        [
          0.278,
          1,
          0.877,
          -0.824,
          -1,
          -0.905,
          0.145,
          0.977
        ],
        [
          -0.512,
          0.134,
          -0.343,
          -0.796,
          -1,
          -1,
          -1,
          -1
        ]
      ],
      "type": "contour"
    }
  ]
}

Python

# Get this figure: fig = py.get_figure("https://plot.ly/~englianhu/149/")
# Get this figure's data: data = py.get_figure("https://plot.ly/~englianhu/149/").get_data()
# Add data to this figure: py.plot(Data([Scatter(x=[1, 2], y=[2, 3])]), filename ="sample2", fileopt="extend")
# Get z data of first trace: z1 = py.get_figure("https://plot.ly/~englianhu/149/").get_data()[0]["z"]

# Get figure documentation: https://plot.ly/python/get-requests/
# Add data documentation: https://plot.ly/python/file-options/

# If you're using unicode in your file, you may need to specify the encoding.
# You can reproduce this figure in Python with the following code!

# Learn about API authentication here: https://plot.ly/python/getting-started
# Find your api_key here: https://plot.ly/settings/api

import plotly.plotly as py
from plotly.graph_objs import *
py.sign_in('username', 'api_key')
trace1 = {
  "z": [
    [6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], [0.278, 1.0, 0.877, -0.824, -1.0, -0.905, 0.145, 0.977], [-0.512, 0.134, -0.343, -0.796, -1.0, -1.0, -1.0, -1.], 
  "type": "contour", 
  "zsrc": "englianhu:150:"
}
data = Data([trace1])
fig = Figure(data=data)
plot_url = py.plot(fig)

Matlab

% Get this figure: fig = getplotlyfig('englianhu', 149)
% Get this figure's data: fig = getplotlyfig('englianhu', 149); fig.data
% Add data to this figure: plotly([1, 2], [2, 3], struct('filename', 'sample2', 'fileopt', 'extend'))
% Get z data of first trace: fig = getplotlyfig('englianhu', 149); z1 = fig.data{1}.z

% Get figure documentation: https://plot.ly/matlab/get-requests/
% Add data documentation: https://plot.ly/matlab/file-options/

% You can reproduce this figure in MATLAB with the following code!

% Learn about API authentication here: https://plot.ly/matlab/getting-started
% Find your api_key here: https://plot.ly/settings/api

signin('username', 'api_key')
trace1 = struct(...
  'z', [6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0; 0.278, 1.0, 0.877, -0.824, -1.0, -0.905, 0.145, 0.977; -0.512, 0.134, -0.343, -0.796, -1.0, -1.0, -1.0, -1.0], ...
  'type', 'contour', ...
  'zsrc', 'englianhu:150:');
data = {trace1};
response = plotly(data);
plot_url = response.url

R

# Get this figure: fig <- get_figure("englianhu", 149)
# Get this figure's data: data <- get_figure("englianhu", 149)$data
# Add data to this figure: p <- add_trace(p, x=c(4, 5), y=c(4, 5), kwargs=list(filename="sample2", fileopt="extend"))
# Get z data of first trace: z1 <- get_figure("englianhu", 149)$data[[1]]$z

# Get figure documentation: https://plot.ly/r/get-requests/
# Add data documentation: https://plot.ly/r/file-options/

# You can reproduce this figure in R with the following code!

# Learn about API authentication here: https://plot.ly/r/getting-started
# Find your api_key here: https://plot.ly/settings/api

library(plotly)
trace1 <- list(
  z = matrix(c(6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 0.278, 1.0, 0.877, -0.824, -1.0, -0.905, 0.145, 0.977, -0.512, 0.134, -0.343, -0.796, -1.0, -1.0, -1.0, -1.0), nrow=3, ncol=8), 
  type = "contour", 
  zsrc = "englianhu:150:"
)
data <- list(trace1)
p <- plot_ly()
p <- add_trace(p, z=trace1$z, type=trace1$type, zsrc=trace1$zsrc)

Plotly.js

/ You can reproduce this figure in plotly.js with the following code!

// Learn more about plotly.js here: https://plot.ly/javascript/getting-started

/* Here's an example minimal HTML template
 *
 * <!DOCTYPE html>
 *   <head>
 *     <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
 *   </head>
 *   <body>
 *   <!-- Plotly chart will be drawn inside this div -->
 *   <div id="plotly-div"></div>
 *     <script>
 *     // JAVASCRIPT CODE GOES HERE
 *     </script>
 *   </body>
 * </html>
 */

trace1 = {
  z: [[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], [0.278, 1.0, 0.877, -0.824, -1.0, -0.905, 0.145, 0.977], [-0.512, 0.134, -0.343, -0.796, -1.0, -1.0, -1.0, -1.0]], 
  type: 'contour', 
  zsrc: 'englianhu:150:'
};
data = [trace1];
Plotly.plot('plotly-div', {
  data: data
});

Node.js

// You can reproduce this figure in node.js with the following code!

// Learn about API authentication here: https://plot.ly/nodejs/getting-started
// Find your api_key here: https://plot.ly/settings/api

var plotly = require('plotly')('username', 'api_key');
trace1 = {
  z: [[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0], [0.278, 1.0, 0.877, -0.824, -1.0, -0.905, 0.145, 0.977], [-0.512, 0.134, -0.343, -0.796, -1.0, -1.0, -1.0, -1.0]], 
  type: 'contour', 
  zsrc: 'englianhu:150:'
};
data = [trace1];
plotly.plot(data, function(err, msg) {
  console.log(msg);
});

Julia

# Get this figure: p = download_plot("https://plot.ly/~englianhu/149/")
# Get this figure's data: data = download_plot("https://plot.ly/~englianhu/149/").plot.data
# Add data to this figure: post(plot(scatter(x=[1, 2], y=[2, 3])); filename="sample2", fileopt="extend"))
# Get z data of first trace: z1 = download_plot("https://plot.ly/~englianhu/149/").plot.data[1]["z"]

# Get figure documentation: https://plot.ly/julia/get-requests/
# Add data documentation: https://plot.ly/julia/file-options/

# You can reproduce this figure in Julia with the following code!

# Learn about API authentication here: https://plot.ly/julia/getting-started
# Find your api_key here: https://plot.ly/settings/api

using Plotly
Plotly.signin("username", "api_key")
trace1 = contour(Dict(
  :z => [6.0 0.278 -0.512; -1.0 1.0 0.134; -1.0 0.877 -0.343; -1.0 -0.824 -0.796; -1.0 -1.0 -1.0; -1.0 -0.905 -1.0; -1.0 0.145 -1.0; -1.0 0.977 -1.0], 
  :type => "contour", 
  :zsrc => "englianhu:150:"
))
data = [trace1]
p = plot(data)
response = post(p)
plot_url = response.url

Reference