暇つぶし2chat TECH - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト750:デフォルトの名無しさん 20/08/19 00:23:15.86 Hd2Bulw5.net plt.gcf().text(0,0,'value=',value) でエラーが出る テキスト文字と変数を同時に表示させるのってどうすればいいのでしょう? 751:デフォルトの名無しさん 20/08/19 00:47:45.59 LSZ+gOY+.net >>727 コレかな? https://stackoverflow.com/questions/42435446/how-to-put-text-outside-python-plots or by using the text m 752:ethod of the figure instead of that of the axes. plt.gcf().text(0.02, 0.5, textstr, fontsize=14) In both cases the coordinates to place the text are in figure coordinates, where (0,0) is the bottom left and (1,1) is the top right of the figure. 753:デフォルトの名無しさん 20/08/19 00:55:11.95 LSZ+gOY+.net https://note.nkmk.me/python-string-concat/ 数値と文字列の連結・結合: +演算子, +=演算子, str(), format() 異なる型の+演算はエラーとなる。 s1 = 'aaa' s2 = 'bbb' i = 100 f = 0.25 # s = s1 + i # TypeError: must be str, not int source: string_concat.py 数値(整数型intや浮動小数点型floatなど)と文字列を連結したい場合は、 数値をstr()で文字列型に変換してから+演算子(または+=演算子)で連結する。 s = s1 + '_' + str(i) + '_' + s2 + '_' + str(f) print(s) # aaa_100_bbb_0.25 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch