sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
describe:
In my recent work, I used Rstudio as the ide of python to write scripts, but the drawing results after using plt.show() will be very blurred and distorted in the drawing pane.
I tried some of the same R code and the output is very clear. Also, I tried to switch between the 1.4 version of Rstudio and the latest version of R (4.12), but the drawing results were also very bad. In addition, I also tried to adjust some parameters of plt.figure(). Although the font and size of the drawing will change, the resolution still cannot be improved.
I saw on the tubing that some people use Rstudio to produce images independently (Qt5Agg), instead of relying on Rstudio's drawing pane. How can I restore the adjustments of this version to the previous state?
Code:
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
tips = sns.load_dataset("tips")
import matplotlib
import tkinter
matplotlib.use('Qt5Agg')
plt.figure(figsize=(10,8),dpi=300)
ax = plt.subplot(111)
plt.xticks(fontsize=5)
plt.yticks(fontsize=5)
ax.set_xlabel(..., fontsize=5)
ax.set_ylabel(..., fontsize=5)
plt.ylabel("Grade")
plt.ylabel("number")
sns.scatterplot( x="total_bill", y="tip",data=tips)
plt.show()
plt.close("all")
plt.savefig('test',dpi=300)