[visit-users] Plot Legend Attributes

Valmor de Almeida val.lists at gmail.com
Wed Mar 31 12:57:29 EDT 2010


Hello,

I've run into this problem before. Below is a section of a python script
I typically use; mayge you can get something useful for you.

--
Valmor

#-------------------------------------------------------------------------------
# Annotations

#print GetAnnotationAttributes()
#sys.exit()
a = AnnotationAttributes()
a.databaseInfoFlag = 0
a.axes3D.visible = 0
a.axes3D.bboxFlag = 0
# vfda 02Oct09
#a.backgroundColor = (0, 0, 128, 255)
a.backgroundColor = (0, 0, 0, 0)
a.foregroundColor = (255, 255, 255, 255)
# vfda 02Oct09
#a.gradientBackgroundStyle = a.Radial  # TopToBottom, BottomToTop,
LeftToRight, RightToLeft, Radial
#a.gradientColor1 = (0, 0, 255, 255)
#a.gradientColor2 = (0, 0, 0, 255)
#a.backgroundMode = a.Gradient  # Solid, Gradient, Image, ImageSphere
a.backgroundMode = a.Solid  # Solid, Gradient, Image, ImageSphere
SetAnnotationAttributes(a)

# Pick compound info create annotation text

silr = SILRestriction()
#print silr.Categories()
compoundInfo = silr.SetName(silr.SetsInCategory('compound')[1])
# print compoundInfo
text = CreateAnnotationObject("Text2D")
#print text
#sys.exit()
text.text = compoundInfo.title()
twidth = 0.95
text.width = twidth
text.position = ( (1.0-twidth)/2.0, 0.925 )

# Control legend

objNames =  GetAnnotationObjectNames()
legend = GetAnnotationObject(objNames[0])
legend.fontBold = 1
legend.drawLabels = 1
legend.drawTitle = 0
legend.fontHeight = 0.02
legend.position = (0.01,0.9) # seems not to work
legend.xScale = 1
legend.yScale = 1
#print legend
#sys.exit()

# Add a time slider for showing host-guest scoring

slider = CreateAnnotationObject("TimeSlider")
slider.position = (0.01,0.02)
slider.width = 0.3
slider.height = 0.04
slider.text = "Score: " + str(1)
slider.timeDisplay = slider.UserSpecified
slider.percentComplete = 1.0/float(nFiles)*100.
#print slider



Mosher, Scott W. wrote:
> Hi,
> 
>  
> 
> Is there a way to get/set the attributes of the legend of a Pseudocolor
> plot from within a Python script?
> 
>  
> 
> Specifically, I’d like to change the legend’s position and bounding box
> color.
> 
>  
> 
> Using the Command box in the GUI to record the script commands for doing
> this yields: “# Logging for SetAnnotationObjectOptions is not
> implemented yet”.
> 
>  
> 
> Scott
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> --
> List subscription information: https://email.ornl.gov/mailman/listinfo/visit-users
> Searchable list archives: https://email.ornl.gov/pipermail/visit-users
> VisIt Users Wiki: http://visitusers.org/
> Frequently Asked Questions for VisIt: http://visit.llnl.gov/FAQ.html
> 



More information about the visit-users mailing list