Example #1
0
def SetLegend(legendInfo):
    # set color box (i.e. position, size, font, etc.)

    legend = visit.GetAnnotationObject(
        visit.GetPlotList().GetPlots(0).plotName)

    # options I like to set

    legend.active = 1
    legend.managePosition = 0
    legend.position = (legendInfo.xlo, legendInfo.yhi)
    legend.xScale = legendInfo.xScale
    legend.yScale = legendInfo.yScale
    legend.orientation = legend.HorizontalBottom  # VerticalRight, VerticalLeft, HorizontalTop, HorizontalBottom
    legend.controlTicks = 1
    legend.numTicks = legendInfo.nTick
    legend.minMaxInclusive = 1
    legend.drawLabels = legend.Values  # None, Values, Labels, Both
    legend.numberFormat = legendInfo.valFormat
    legend.drawTitle = 0
    legend.drawMinMax = 0
    legend.fontHeight = legendInfo.fontHeight

    # other options

    legend.suppliedValues = (1, 2, 3, 4, 5)
    legend.suppliedLabels = ("A", "B", "C", "D", "E")
Example #2
0
def make_slide(time):
    plasma_file = vtk_path + plasma_file_head + str(time) +'.vtk'
    paraxial_file = vtk_path + paraxial_file_head + str(time) + '.vtk'
    fullwave_file = vtk_path + fullwave_file_head + str(time) + '.vtk'
    
    print('opening plamsa file:' + plasma_file)
    sts = vi.OpenDatabase(plasma_file,0,'VTK')
    if (sts != 1):
        print('open file failed! error code:' + str(sts))
        return
    
    sts = vi.AddPlot('Pseudocolor','cutoff')
    vi.DrawPlots()
    po = vi.GetPlotOptions()
    vi.LoadAttribute(plasma_attr_file,po)
    vi.SetPlotOptions(po)
    
    print('opening paraxial file:' + paraxial_file)
    sts = vi.OpenDatabase(paraxial_file,0,'VTK')
    if (sts != 1):
        print('open file failed! error code:' + str(sts))
        return
    
    sts = vi.AddPlot('Pseudocolor','Er_para')
    vi.DrawPlots()
    po = vi.GetPlotOptions()
    vi.LoadAttribute(wave_attr_file,po)
    vi.SetPlotOptions(po)
    
    print('opening fullwave file:' + fullwave_file)
    sts = vi.OpenDatabase(fullwave_file,0,'VTK')
    if (sts != 1):
        print('open file failed! error code:' + str(sts))
        return
    
    sts = vi.AddPlot('Pseudocolor','Er_fullw')
    vi.DrawPlots()
    po = vi.GetPlotOptions()
    vi.LoadAttribute(wave_attr_file,po)
    vi.SetPlotOptions(po)
    
    view_attr = vi.GetView3D()
    vi.LoadAttribute(view_attr_file,view_attr)
    vi.SetView3D(view_attr)
    
    anno_attr = vi.GetAnnotationAttributes()
    vi.LoadAttribute(annotation_attr_file,anno_attr)
    vi.SetAnnotationAttributes(anno_attr)
    
    anno_names = vi.GetAnnotationObjectNames()
    for name in anno_names:
        legend = vi.GetAnnotationObject(name)
        legend.numberFormat = "%# -9.2g"
        legend.drawMinMax = 0
        legend.controlTicks = 1
        legend.numTicks = 3
         
        
    vi.SaveWindow()
Example #3
0
 def set_annotation_objects(f, prefix):
     f.write('# Set annotation object properties\n')
     names = visit.GetAnnotationObjectNames()
     index = 0
     plotNames = []
     for name in names:
         obj = visit.GetAnnotationObject(name)
         objtype = object_type(obj)
         newname = prefix + "obj%03d" % index
         index = index + 1
         if objtype == 'LineObject':
             f.write('%s = CreateAnnotationObject("Line2D", "%s")\n' %
                     (newname, name))
         elif objtype == 'Text2DObject':
             f.write('%s = CreateAnnotationObject("Text2D", "%s")\n' %
                     (newname, name))
         elif objtype == 'ImageObject':
             f.write('%s = CreateAnnotationObject("Image", "%s")\n' %
                     (newname, name))
         elif objtype == 'TimeSliderObject':
             f.write('%s = CreateAnnotationObject("TimeSlider", "%s")\n' %
                     (newname, name))
         elif objtype == 'LegendAttributesObject':
             plotNames = plotNames + [name]
             continue
         write_state_object_atts(f, obj, newname)
         f.write('\n')
     index = 0
     for name in plotNames:
         legend = prefix + "legend%03d" % index
         f.write(
             '%s = GetAnnotationObject(GetPlotList().GetPlots(%d).plotName)\n'
             % (legend, index))
         write_state_object_atts(f, visit.GetAnnotationObject(name), legend)
         index += 1
     f.write('\n')
Example #4
0
    def __init__(self, pname, ptype, patts, varname=None):
        """Plot class"""
        self.pname = pname
        self.varname = varname
        self.ptype = ptype
        self.patts = patts
        self.operators = []
        self.annot = v.GetAnnotationObject(pname)
        self.annot.fontFamily = vrc.getDefaultFont()
        self.annot.fontHeight = vrc.rcParams['legend.fontheight']
        self.annot.managePosition = 0
        self.annot.xScale = vrc.rcParams['legend.scale'][0]
        self.annot.yScale = vrc.rcParams['legend.scale'][1]
        self.annot.position = vrc.rcParams['legend.position']
        self.annot.drawMinMax = vrc.rcParams['legend.minmax']

        if varname is not None:
            self.annot.drawTitle = 0
            self.title = v.CreateAnnotationObject("Text2D")
            self.title.text = varname
            self.title.fontFamily = vrc.getDefaultFont()
            self.title.height = vrc.rcParams['legend.title.fontheight']
            self.title.position = vrc.rcParams['legend.title.position']
aa.axes2D.xAxis.tickMarks.minorSpacing = (kxhi - kxlo) / 16.
aa.axes2D.xAxis.tickMarks.majorSpacing = (kxhi - kxlo) / 4.
aa.axes2D.xAxis.grid = 1
aa.axes2D.yAxis.title.visible = 0
aa.axes2D.yAxis.label.visible = 0
aa.axes2D.yAxis.tickMarks.visible = 1
aa.axes2D.yAxis.tickMarks.majorMinimum = kylo
aa.axes2D.yAxis.tickMarks.majorMaximum = kyhi
aa.axes2D.yAxis.tickMarks.minorSpacing = (kyhi - kylo) / 16.
aa.axes2D.yAxis.tickMarks.majorSpacing = (kyhi - kylo) / 4.
aa.axes2D.yAxis.grid = 1
visit.SetAnnotationAttributes(aa)

# colorbox setting

legend = visit.GetAnnotationObject(visit.GetPlotList().GetPlots(0).plotName)
legend.active = 1
legend.managePosition = 0
legend.position = (0.5, 0.08)
legend.xScale = 1.2
legend.yScale = 0.4
legend.orientation = legend.HorizontalBottom  # VerticalRight, VerticalLeft, HorizontalTop, HorizontalBottom
legend.controlTicks = 1
legend.numTicks = 5
legend.minMaxInclusive = 1
legend.drawLabels = legend.Values  # None, Values, Labels, Both
legend.numberFormat = "%.2f"
legend.drawTitle = 0
legend.drawMinMax = 0
legend.fontHeight = 0.08
Example #6
0
def viewit():
    tl = visit.CreateAnnotationObject("Text2D")
    tl.position = (.08, .93)
    tl.height = .026
    tl.fontFamily = 0
    tl.fontBold = 1
    tl.fontShadow = 1

    visit.DeleteAllPlots()

    k = 30000
    kMax = 40001

    while k < kMax:
        filename = "scalar" + str(k) + ".Point3D"
        print "opening database file:  " + filename
        status = visit.OpenDatabase(filename, 0, "Point3D")

        if status != 1:
            print "Could not open " + filename
            return

        status = visit.AddPlot("Pseudocolor", "density")
        visit.DrawPlots()
        pca = visit.GetPlotOptions()
        pca.colorTableName = "density"
        pca.invertColorTable = 1
        pca.minFlag = 1
        pca.maxFlag = 1
        pca.min = -.21
        pca.max = .21
        #     visit.SetPlotOptions(pca)

        names = visit.GetAnnotationObjectNames()
        print names
        lastName = names[-1]
        print "lastName = " + lastName

        legend = visit.GetAnnotationObject(lastName)
        legend.numTicks = 3
        legend.managePosition = 0
        legend.position = (.1, .88)
        legend.orientation = 1
        legend.drawMinMax = 0
        legend.drawTitle = 0
        legend.drawLabels = "Labels"
        legend.suppliedLabels = (" -.15", " 0.", " .15")
        legend.fontHeight = .024
        legend.numberFormat = "%#-9.2g"
        legend.fontFamily = 2
        legend.fontBold = 1

        tl.text = "Density Fluctuation  -  Step " + str(k)
        tl.visible = 1
        visit.SaveWindow()
        k = k + 1000

        if k < kMax:
            tl.visible = 0
            visit.DeleteAllPlots()
            visit.CloseDatabase(filename)
Example #7
0
annot_attr.axes3D.yAxis.title.title = "Y"
annot_attr.axes3D.yAxis.title.font.scale = 1.5

annot_attr.axes3D.zAxis.title.userTitle = True
annot_attr.axes3D.zAxis.title.title = "image * gauss"
annot_attr.axes3D.zAxis.title.font.scale = 1.5
annot_attr.axes3D.zAxis.tickMarks.visible = False
annot_attr.axes3D.zAxis.label.visible = False

annot_attr.userInfoFlag = False
annot_attr.databaseInfoFlag = False
visit.SetAnnotationAttributes(annot_attr)

## Set plot Annotations:
p = visit.GetAnnotationObjectNames()[0]
psc_ann = visit.GetAnnotationObject(p)
psc_ann.drawTitle = False
psc_ann.managePosition = False
psc_ann.position = (0.05, 0.98)
psc_ann.orientation = psc_ann.HorizontalTop

## SaveWindow attributes
swa = visit.SaveWindowAttributes()
#swa.outputToCurrentDirectory = False
#swa.outputDirectory = "2d_filter_frames"
#swa.format = swa.JPEG
#swa.quality = 100
#visit.SetSaveWindowAttributes(swa)

## Set properties for the animation:
animation_settings = MoverSettings()