0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Google Colaboratory plotly グラフ出力

Posted at

Google Colaboratory で plotly を使ってグラフを出力する場合の前処理メモ
いろんなエラーが起きるため事前にこれを実行しておく。

!pip install plotly==5.1.0
!pip install -U kaleido
!wget https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage -O /usr/local/bin/orca
!chmod +x /usr/local/bin/orca
!apt-get install xvfb libgtk2.0-0 libgconf-2-4

コードはこんな感じ

import plotly
import plotly.graph_objs as go

fig = go.Figure()



fig.show()
fig.write_image("test.png")

Google Drive にファイルを出力する場合
ファイル出力の前にGoogle Driveをマウントしておく。

import os
from google.colab import drive
drive.mount('/content/drive')
os.chdir(f'/content/drive/MyDrive/フォルダ/')

フォルダ以下に出力される。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?