本文整理汇总了Python中plotly.tools.FigureFactory.create_scatterplotmatrix方法的典型用法代码示例。如果您正苦于以下问题:Python FigureFactory.create_scatterplotmatrix方法的具体用法?Python FigureFactory.create_scatterplotmatrix怎么用?Python FigureFactory.create_scatterplotmatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plotly.tools.FigureFactory
的用法示例。
在下文中一共展示了FigureFactory.create_scatterplotmatrix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scatter_matrix
# 需要导入模块: from plotly.tools import FigureFactory [as 别名]
# 或者: from plotly.tools.FigureFactory import create_scatterplotmatrix [as 别名]
def scatter_matrix(self, dataframe, select_columns=None, index_colname=None,
diag_kind='scatter',
marker_size=10, height=800, width=1000, marker_outline_width=0,
marker_outline_color='black'):
"""
Create a scatter matrix plot from dataframes using Plotly.
Args:
dataframe: (array) array of the data with column headers
select_columns: (list) names/headers of columns to plot from the dataframe
index_colname: (str) name of the index column in data array
diag_kind: (str) sets the chart type for the main diagonal plots (default='scatter')
Choose from 'scatter'/'box'/'histogram'
marker_size: (float) sets the marker size (in px)
height: (int/float) sets the height of the chart
width: (int/float) sets the width of the chart
marker_outline_width: (int) thickness of marker outline (currently affects the outline of histograms too
when "diag_kind" = 'histogram')
marker_outline_color: (str/array) color of marker outline - accepts similar formats as other color variables
Returns: a Plotly scatter matrix plot
"""
df = dataframe[select_columns] if select_columns else dataframe
fig = FF.create_scatterplotmatrix(df, index=index_colname, diag=diag_kind, size=marker_size,
height=height, width=width)
# Add outline to markers
for trace in fig['data']:
trace['marker']['line'] = dict(width=marker_outline_width, color=marker_outline_color)
self.create_plot(fig)
示例2: scatter_matrix
# 需要导入模块: from plotly.tools import FigureFactory [as 别名]
# 或者: from plotly.tools.FigureFactory import create_scatterplotmatrix [as 别名]
def scatter_matrix(self, dataframe, select_columns=None, index_colname=None, diag_kind='scatter',
marker_size=10, height=800, width=1000, marker_outline_width=0, marker_outline_color='black'):
"""
Create a scatter matrix plot from dataframes using Plotly.
Args:
dataframe: (array) array of the data with column headers
select_columns: (list) names/headers of columns to plot from the dataframe
index_colname: (str) name of the index column in data array
diag_kind: (str) sets the chart type for the main diagonal plots (default='scatter')
Choose from 'scatter'/'box'/'histogram'
marker_size: (float) sets the marker size (in px)
height: (int/float) sets the height of the chart
width: (int/float) sets the width of the chart
marker_outline_width: (int) thickness of marker outline (currently affects the outline of histograms too
when "diag_kind" = 'histogram')
marker_outline_color: (str/array) color of marker outline - accepts similar formats as other color variables
Returns: a Plotly scatter matrix plot
"""
df = dataframe[select_columns] if select_columns else dataframe
fig = FF.create_scatterplotmatrix(df, index=index_colname, diag=diag_kind, size=marker_size,
height=height, width=width)
# Add outline to markers
for trace in fig['data']:
trace['marker']['line'] = dict(width=marker_outline_width, color=marker_outline_color)
if self.plot_mode == 'offline':
if self.filename:
plotly.offline.plot(fig, filename=self.filename)
else:
plotly.offline.plot(fig)
elif self.plot_mode == 'notebook':
plotly.offline.init_notebook_mode() # run at the start of every notebook; version 1.9.4 required
plotly.offline.iplot(fig)
elif self.plot_mode == 'online':
plotly.tools.set_credentials_file(username=self.username, api_key=self.api_key)
if self.filename:
plotly.plotly.plot(fig, filename=self.filename, sharing='public')
else:
plotly.plotly.plot(fig, sharing='public')
elif self.plot_mode == 'static':
plotly.plotly.image.save_as(fig, filename=self.filename, height=self.height, width=self.width,
scale=self.scale)
示例3: statisticplots
# 需要导入模块: from plotly.tools import FigureFactory [as 别名]
# 或者: from plotly.tools.FigureFactory import create_scatterplotmatrix [as 别名]
def statisticplots(filename, plotkind,columns):
try:
data = pd.read_csv(filename,index_col=0, parse_dates=True)
except(FileNotFoundError, IOError):
print('Wrong file or file path.')
return None
if columns is None or not columns:
columns = list(data.columns.values)
data = data.ix[:,columns]
if plotkind == 'scattermatrix':
fig = FF.create_scatterplotmatrix(data,diag='box',title='Scattermatrix plot of {}'.format(filename[:-4]))
elif plotkind == 'line':
fig = data.iplot(theme='pearl',kind='scatter',title='Line plot of {}.'.format(filename[:-4]),subplots=True,asFigure=True)
elif plotkind == 'box':
fig = data.iplot(theme='pearl',kind='box',title='Box plot of {}.'.format(filename[:-4]),asFigure=True)
py.plot(fig,filename='../../plots/'+filename[:-4]+plotkind,validate=False,auto_open=False)
示例4: print
# 需要导入模块: from plotly.tools import FigureFactory [as 别名]
# 或者: from plotly.tools.FigureFactory import create_scatterplotmatrix [as 别名]
import plotly
import plotly.plotly as py
from plotly.tools import FigureFactory as FF
import numpy as np
import pandas as pd
print(plotly.__version__)
dataframe = pd.DataFrame(np.random.randn(100, 3),
columns=['A', 'B', 'C'])
fig = FF.create_scatterplotmatrix(dataframe, diag='histogram', index='A',
colormap=['rgb(200, 150, 90)', '#3012CF', 'rgb(20, 124, 246)'],
colormap_type='seq', height=700, width=700)
py.plot(fig, filename = 'Customized Colormap')