set size square
または、その省略形で
set size sq
というコマンドを使えば正方形の中にグラフを描くことができる。
例
set size square
plot cos(x)
結果
![](https://hanjouchan.org/wp-content/uploads/2021/07/screenshot-2021-07-01-at-14.21.47-1024x941.png)
雑記
投稿日:
set size square
または、その省略形で
set size sq
というコマンドを使えば正方形の中にグラフを描くことができる。
set size square
plot cos(x)
執筆者:seyanen
関連記事
破線をカスタマイズする方法 以下では、dashes = [5,2,2,2] で、線5・空白2・線2・空白2の破線を指定している。 詳しくは次を参照。 https://matplotlib.org/st …
matplotlib で、粗い刻みと細かい刻みの目盛りを表示する方法
set_major_locator で粗い刻みの目盛りを調整する。 set_minor_locator で、細かい刻みの目盛りを調整する。 以下の例で set_major_formatter は、表示 …
python3 で、csv ファイルを読み込んで条件をみたす行の内容を表示する方法
csv.reader で読み込み、各行を読み込んで判定する。 例 import csv with open(‘data.csv’, ‘r’) as csv_file: reader = csv.rea …
辞書に対して、items() メソッドを使うと、タプルを作成することができる。 例 cities = {‘東京’:1000,’大阪’:700, ‘広島’:100} for a,b in cities. …
matplotlib でグラフの背景の色を変える方法(facecolor)
次のように、axes で facecolor を変更すればよい。 例 from matplotlib import pyplot as plt x = [2,7,8] y = [7,1 …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。