[yt-dev] Issue #1061: Poor projection plot image quality in 3.2 (yt_analysis/yt)

ggoodwin52 issues-reply at bitbucket.org
Mon Aug 10 08:03:25 PDT 2015


New issue 1061: Poor projection plot image quality in 3.2
https://bitbucket.org/yt_analysis/yt/issues/1061/poor-projection-plot-image-quality-in-32

ggoodwin52:

I recently started using 3.2 instead of 3.1 and noticed that the quality of the projection plot images decreased in the newest stable release of yt. I believe it is due to a lower resolution when rendering the plot in 3.2. 

Attached is a plot of the same temperature data, using both 3.1 and 3.2. You will notice that in the 3.2 plot the shocks (green/blue temperature discontinuities) and the flame front (transition from red flame to yellow/green/blue gas) appear rough and pixelated, whereas they are nice and smooth in the 3.1 plot. This is not due to the computational cell size, as the cells along the flame and shocks are much smaller (3.333E-4 cm x 3.333E-4 cm) than the blocks you see in the plot image.

Below is the code I used to generate these plots. The data I used is here: [http://use.yt/upload/a2346bb9](http://use.yt/upload/a2346bb9)

The plot looks ok when using the default image size of 8, but when a larger image is used (I usually use 12) the quality is not as good.


```
#!python

import yt
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.ticker import IndexLocator

os.chdir("/lustre/ggoodwin/Ethylene_Air/plot_files_ethylene_br0.1_120cells_4nlev/det")

colors1 = plt.cm.jet(np.linspace(0.0, 0.9, 1*2200)) #(0.2, 0.8, 25))
colors2 = plt.cm.hot_r(np.linspace(0.95, 1., 1*7716)) # 7716 
colors3 = plt.cm.hot(np.linspace(0., 0.8, 1*14660)) # 14660 start at 2600K
colors = np.vstack((colors1, colors2, colors3))
mymap = mcolors.LinearSegmentedColormap.from_list('my_colormap', colors, N=1*(2200+8578+13798))

ds = yt.load("plt000172380")
ad = ds.all_data()
products = ad.cut_region(['(obj["signed dist func"] < 0) & (obj["reactant mass frac"] < 0.5)']) # & (obj["y"] > 0.31)'])
ploc = products.quantities.max_location("x")
yH = ad.quantities.max_location("y")
yy = ploc[0] - 0.5*yH[0] #+ 0.3*yH[0]
yy2 = yy.value
string = 'temperature' #schlieren
cut = ad.cut_region(['(obj["signed dist func"] < 0)'])# & (obj["temperature"] >= 1000.)'])
wide = 1.6 #1.6
height = 0.32 #0.32
if yy2 < wide/2.:
    cent = wide/2.
else: 
    cent = yy2

p = yt.ProjectionPlot(ds,2,string,center=[cent,height,0],width=(wide,height),origin="native",data_source=cut,method='integrate',weight_field='temperature')#,data_source=cut
p.set_log(string,False)
p.set_center((float(cent),float(height/2.)))
p.set_minorticks(string,'off')
p.set_zlim(string,300,6000) #1E-3,10
#p.set_zlim(string,1.E-3,50)
p.plots[string].hide_colorbar()
p.set_colorbar_label(string, '') #'Temperature [K]')
p.set_cbar_minorticks(string,'off')
p.set_cmap(field=string, cmap=mymap) #cmap='kamae_r') #'gray_r')
p.set_figure_size('12') #12
p.set_font({'size':12})

p.save("/lustre/ggoodwin/Ethylene_Air/images/test")
```








More information about the yt-dev mailing list