SAS sgpanel will center justify a footnote of more than two lines when a legend is present - graphics

I am generating a figure using sgpanel with a left justified footnote. The justify=left works when the footnote is either short enough to fit on a single line, or if the plot does not have a legend. But when the legend is too long, so a line break is automatically inserted, then the footnote becomes center justified. But only if there is a legend.
footnote1 justify=left "This footnote is two lines long in a plot created by sgpanel with a legend. Therefore, it will for some reason be center justified instead of left justified. ";
proc sgpanel data=sashelp.cars pctlevel=graph;
panelby origin;
where origin in("Asia" "Europe");
vbar type / response=horsepower stat=percent
group=cylinders;
run;
The result is:
I can get around this by breaking the footnote up in two myself (footnote1 and footnote2) each being left justified and shorter than one line. But why is this happening, and is there another way of getting around it?

When I run your program in a generic SAS/EG session I don't see that behavior in the results window. What is your ODS destination and SAS version.
SYSVLONG=9.04.01M6P110718

Related

Trim VLA-OBJECTS Outside Circles automatically without selecting anything

what I want to do is to trim some polylines that are saved as VLA-OBJECTS, there is no problem on converting them into Entities, but what I graphically want is to trim my Image in the following way:
So as you can see I want to trim everything of the blue lines outside the red circles on the corners and I want to it automatically without selecting anything. For this purpose, I have stored the circle as a VLA-OBJECT, The blue polylines as independent VLA-OBJECTS, the centers of the circles, in fact everything on the first image is stored on memory as a VLA-OBJECT. So I was wondering if you can suggest any lisp routine to do it automatically?. I was thinking on using the Break command or the Extend command but I can not find a real solution. Many thanks in advance.
I have no time enought to prepare working sample code, but I may show You the way. I would try to make it in this way:
You can find intersections of circles and lines.
( vlax-invoke-method circle 'IntersectWith BlueLine acExtendNone )
break each blue line by this
(foreach line BlueLines
(command "_break" line pt pt ) ; where pt is point returned by IntersectWith
)
and the last step is to check if all entities created by _break are inside or outside circles.
You don't have easy access to entities created by _break. to get them, You may use (entlast) before command _break. and (entnext) after that .

Matplotlib using text instead of marker BUT can't be the best way to do it?

I would just like to make sure I am on the right track here as this seems to be pretty cumbersome for Matplotlib. I want to use a label as a marker on a plot and have it working to some degree. It uses mathtext BUT I wonder if there isn't another way to do it? Here is the code.
import matplotlib.pyplot as plt
x = []
y = []
symbol = "AAPL"
x = range(5)
y = [5,10,12,15,11]
plt.plot(x,y,lw=2.5,color='r',linestyle='solid',marker=r"$ {} $".format(symbol),markersize=25)
plt.show()
I am not 100% sure what you want, but below I have listed a couple of options that I am aware of for putting text into plots at specific locations (essentially what a marker is).
1) you can uses text/characters as markers through unicode. This is done by adding the unicode value within mathtext characters. E.g. take your example code; you can make the marker a unicode character by adding a 'u' before the string (unneeded in python 3) and then a '\u' and a 4 digit number. this will produce a unicode marker. Not all will work, as it depends on whether your system's font supports it. You can find a long list of them here: http://unicode-table.com/en/#latin-extended-a
plt.plot(x,y,lw=2.5,color='r',linestyle='solid',marker=u'$\u2609$',markersize=25)
\u2609 will produce a 'sun', i.e. a circle with a dot in its centre.
2) plt.text(...) using this function you can add text of your choice to the coordinate you specify.
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.text
I believe the coordinate will correspond to the bottom left corner of the text box, but you can play around with it to make absolutely sure if you want. E.g.
plt.text(x,y,'string',fontsize=18)
However, this must be done on individual points and will not plot a line over the data; it does not work like 'plot' although you could always brute force a line over the top with a subsequent line plot. This method is more of a pain and hardly optimal but it will do the job and is quite flecible if you want a string for a marker.

How can I draw to an XY position in Emacs?

I wanted to allow the Emacs cursor to move around freely outside of actual text (similar to virtualedit=all in Vim).
"Oh," I thought, "I'll just keep track of a virtual cursor and draw it to the screen myself."
But it turns out the actual native C drawing routines (such as draw_glyphs) seem to refer back to the buffer contents to decide what to draw (I could be wrong though).
My next idea was to make a giant overlay of all spaces so I'd have complete freedom where to put stuff. But an overlay only goes over ranges of actual text, so again, this does not seem to give me what I'm looking for.
Is this a reasonable goal without hacking the C code?
I believe the writeable area of a window is intrinsically limited to the buffer with which it is associated, i.e. you have to draw in an area where buffer content exists.
(One example of this limitation is the impossibility of drawing a vertical guide line in the 80th column to help the user identify long lines; currently the best possible implementation of such a feature is to highlight the "overflow" of each too-long line.)
You can do the same as what artist-mode does without adding spaces to the buffer:
when trying to place the cursor after the end of the line, just use an overlay with an after-string property which adds the spaces in the display without modifying the buffer.
Have a look at "artist-mode" (M-xartist-modeRET) - it allows you to draw in Emacs.
From the function documentation: "Artist lets you draw lines, squares, rectangles and poly-lines, ellipses and circles with your mouse and/or keyboard."
You can look at popup.el from the auto-complete package, which can pop up tooltips and menus and such at any position, including positions outside the contents of the buffer. Maybe that will show you how you can do it.

NSAttributedString: wrapping + truncation

I have a view that draws multicolored text inside UITableViewCell. To draw multicolored text I'm using NSAttributedString However, I would like to make it so that if the text is too long to fit into the view, the last visible line is truncated to display an ellipsis at its end.
Obviously this is very easy to do when drawing only a single line, as you can just set
kCTLineBreakByTruncatingTail for the line break mode of the paragraph style. The problem is that I want my text to wrap to fill the rectangle, and then only have the last line truncated with an ellipsis - setting the line break mode confines the whole text to one line.
Does anybody have any ideas of how I would go about this?
Many thanks in advance for any suggestions,
JC.
Create your CTFrame from your CTFrameSetter with the rectangle of your UITableViewCell. Then, you can get all the CTLines of your CTFrame and determine when they will cut off. To swap out the ellipsis, you could keep that drawn with a separate CTFrame and draw it over the overflowing text on the last line.
You can find working code here: https://stackoverflow.com/a/14612598/473067
It's a similar approach to what Heath suggested. But then all wrapped up in a shiny package.
Well, to activate text truncating in UILabel, you should re-set lineBreakMode parameter to NSLineBreakByTruncatingTail after setting attributedText.
textLabel.attributedText = attributedText;
textLabel.lineBreakMode = NSLineBreakByTruncatingTail;

LaTeX \includegraphics and textline

Ok, I am beat. I tried a few things but I am unable to make this happen. I need some help now.
I want to be able to have some text and picture side by side (only one line, thus no need for wrapping or other fun. The picture is small enough to fit in a text line):
This is a text <temp.jpg placed center to the textline>
Problem is, when I use
This is a text \includegraphics{temp.jpg}
the pictures baseline is alligned with the text baseline. I want the picture (vertical) center to be aligned with the text baseline. How can I make this possible?
This is a text $\vcenter{\hbox{\includegraphics{temp.jpg}}}$
It sounds like you want \raisebox (see the raisebox section of the LaTeX wikibook), with a negative argument. Use dimensions ex (the notional height of an 'x' in the current font) or \baselineskip (the size between text baselines) as your units.
If you want to do more complicated things, such as move the graphics box down by half its height, you can, but it gets fiddly. If the graphic size isn't unpredictable, you're probably better off tuning this by hand anyway.
In my opinion, most simple answer \raisebox{-0.5\totalheight}{<your graphic here>}
This is a text \raisebox{-0.5\totalheight}{\includegraphics{temp.jpg}}
Explanation:
\raisebox moves vertically the whole text/picture given as second argument. The first argument is the vertical shift as a length. This command provides the length \totalheight which is, self-explanatory, the height of the whole text/picture that you want to raise. The factor -0.5 lowers exactly at the half of the length(as the question demands). For aesthetic adjustments just modify the factor's value.
By the way, with this method there is no need to get into math mode as in #AlexeiMalistov answer, and no need of double command \vcenter + \hbox

Resources