Closed XushanLu closed 3 years ago
Hi @XushanLu no surprise that you didn't find it... it was really well hidden in vtk :) Try this:
if iobs == 0:
rx.caption('Profile {:d}'.format(iprof+1), obs, [0.05, 0.025], justify='center')
rx._caption.GetProperty().SetOpacity(1)
rx._caption.GetProperty().SetLineWidth(3)
Also you may not need to modify LegendBox
, just use:
lbox = LegendBox([inps, recs, ellipsoid], width=0.15, pos=(0.8,0.7))
You also seem to have some overlapping lines (top-left of figure) you may want to add a small tolerance in z to make them distinguishable.
PS: not that you can simplify the Axes
creation without the need of unpacking them
axes = Axes(group,
xtitle='x (m)',
xTitlePosition=0.55,
xLabelSize=0.02,
xLabelRotation=180,
xLabelOffset=-1.6,
xTitleRotation=180,
xTitleOffset=-0.12,
xShiftAlongY=1,
ytitle='y (m)',
yTitlePosition=0.55,
yTitleOffset=-0.15,
yLabelSize=0.02,
yLabelRotation=90,
yLabelOffset=-1.5,
yShiftAlongX=1,
ztitle='z (m)',
zrange=[-60, 10],
zValuesAndLabels=[(-50, '-50'), (0, '0')],
zTitlePosition=0.65,
zAxisRotation=90,
zLabelSize=0.02,
zShiftAlongX=1,
axesLineWidth=3,
gridLineWidth=5,
tipSize=0,
xyFrameLine=True,
zxGrid=True,
xyGrid=True,
)
### COMMENT-OUT unpack() loop
# for a in axes.unpack():
# # print(a.name)
# if "ztitle" in a.name:
# xb = group.xbounds()
# a.shift((xb[1]-xb[0]), 0, 0)
# if ("xAxis" in a.name or "xM" in a.name or "xN" in a.name):
# yb = group.ybounds()
# a.shift(0, (yb[1]-yb[0]), 0)
btw, this was implemented in vedo
from your input !! :)
Hi Marco,
Thanks very much for your comments. I am no good at c/c++ at all and it is probably not surprising that I cannot find it. Now I can finally control the size of it. Previously it was just so tiny!
I did not know I can just specify pos=(0.8, 0.7) like that. I think the documentation was not clear about this. You may want to add a bit more description there. I then quickly went through the code and thought what I did there was the only possible way to make it happen. I think I still don't quite understand the code there but I don't need to worry about it if it works!
Yes, thanks for pointing out the overlapping. I am aware it is happening but did not bother to get anything done to make them distinguishable. I will do that later for publications.
It is great to see that the axes do not need to be unpacked now. I think the current implementation is a lot neater!
Thanks very much for your help.
Xushan
Hi @marcomusy,
I am trying to add a caption to certain elements in my plot and I could not find a way to increase the size of the leader line that points the caption to the object it is associated with.
Code used:
And all the data are in the zip file: data_files.zip
Here is the final plot I got: As you can see, the line that points to the object from the caption is extremely small. I did not find anything that can be changed in the function caption, and I also don't think there is anything in the lower-level vtk code either (vtk.vtkCaptionActor2D). Do you have any idea how to make that line more visible?
PS: I have made some changes to the function caption to switch off the caption box and LegendBox to allow a more flexible positioning of the legend box: