How to draw a line on image using matlab where the end points are not able to specify? - line

I have used line() function in matlab to draw line over an image. The line is drawn successfully but the problem is it is not saving on the image or in other words I can't save the line drawn image. I need this lined image for later stages. I can see the lined image. But it is not shown when again that particular image is loaded.

Your question is too specific, but to give you an idea. Images in Matlab are saved as a matrix so you have a column and row of values.
You can alter or access a column or a row of an image easily using the : operator. For instance, to get the first row of data you can do img(1,:), that is to mean all elements in the first row.
I hope with this hint you can solve your problem easily.

You are probably looking for
hold on;
For example:
figure();
plot(1:10,1:10);
hold on;
plot(1:10,2:11,'r')

Related

How to add descriptions on selected data series to an area plot in mathplotlib

I created a graph that looks alright to me with the following line of code:
df_wide.plot.area(xticks=df_wide.index, legend=False, xlabel= 'Week', ylabel='Percent', title='Percentage of Letters')
However I would like to add the name of selected (or all) dataseries to the right side of the Graph, so that it attaches little lines to the right side and the column name appears next to it, I attach a picture with my current output and how I want it to look (not exactly well edited, but I am sure you get the idea)...
Maybe somebody can helb me :) Thank you!

How to make long text fit into a text_frame? Python-pptx

I'm working with python-ppt to create a portfolio of candidates in a Powerpoint presentation. There is one candidate per slide and each of them has provided information about themselves like name, contacts and a minibio (the problem I'm here to solve)
The text_frame, created with values of height and width, must fit the slide but must a contain all lenght of minibios, which is not happening.
In a long phase (>200 char, with font size 12) it exceeds the size of the text box and get "out" of the slide, so, in presentation mode or a PDF file, the "overrun" of text is lost
Is there any way to confine the text to the shape/size of the text_frame? (extra help if the solution wont change font size)
Just found one parameter that helped to find the answer
When creating a text_box object with slides.shapes.add_textbox() and adding a text_frame to it, the text_frame.word_wrap = True limits the text to be contained inside the dimentions of the text_box
The code shows it better
# creates text box with add_textbox(left, top, width, height)
txBox = slide.shapes.add_textbox(Cm(16),Cm(5),Cm(17),Cm(13))
tf = txBox.text_frame
tf.word_wrap = True
Before word_wrap parameter
After word_wrap parameter
The short answer is "No". PowerPoint is a page-layout environment, and much like the front page of a newspaper, text "story" content needs to be trimmed to fit the allotted space.
We're perhaps not used to this because word-processing, spreadsheet, and web-page content is "flowed" into a (practically) unlimited space, but the area of a PowerPoint slide is quite finite. Also, using it for large text blocks is somewhat of an off-label use. There is a certain amount of flexibility provided by reducing the font size, but not as much as one might expect. Even accommodating 20% additional text requires what appears as a pretty radical change in font size.
I've encountered this problem again and again, and the only solution I have ever seen work reliably is hand-curating the content to fit.
python-pptx has one experimental feature to address this but its operation has never been very satisfactory and it's tricky to get working. https://python-pptx.readthedocs.io/en/latest/api/text.html#pptx.text.text.TextFrame.fit_text
The business of fitting text is the role of a rendering engine, which python-pptx is not.

Can VBA detect line-wrapping in an Excel chart legend?

Context
Writing to code to format a chart (all of which should be done by Microsoft, but that’s separate).
Am now positioning the legend. Taking a 9×9 block of possible positions, and counting the data points underneath each. As a fragment of the code: (ax.MaximumScale - ax.MinimumScale) * co.Chart.Legend.Width / co.Chart.PlotArea.InsideWidth.
Also coping with lines underlapping and text boxes overlapping the possible legend positions: same idea, more complexity.
Question
Obviously, all this works better if the legend is as small as possible, as that gives a greater likelihood of finding a location with zero ’lapping.
If .Legend.Width is too small, then the individual legend texts (the Series.Name’s) wrap onto ≥2 lines, which isn’t wanted. So VBA could interval bisect to find the smallest .Legend.Width for which there isn’t line wrapping. But how can the VBA code ‘see’|‘detect’|‘know’ of the existence of the line wrapping?
And mutatis mutandis for .Legend.Height: if that’s too small, some legend entries aren’t shown. How can the VBA code ‘see’|‘detect’|‘know’ that a height is too small?
Thank you.
PS: I expect that the correct answer is that “VBA cannot ‘see’|‘detect’|‘know’ either of these.” Please refute this expectation.
If you create your own legend, using a text box, you have better options when it comes to sizing and flow control. This will create a new set of challenges, but it might be easier to handle.

Pictures do not go to their designated spots when copied to canvas

Link to code
I am attempting to move 5, individual pictures (as defined at the beginning of the code) and manipulate each picture in a different way. Each function that is used to manipulate a picture has a pretty obvious name for what is going to happen to that picture
I am using Jes to code this in Jython.
My problem is that even though I clearly specify where on my final canvas that I want these pictures to go to, they for some reason all default to (0, 0). So basically, the only picture that will be displayed is whichever the last one is that is called on. If you were to comment out the last picture, which in the code is the fifth (the "lighten" one), the fourth picture would be the one that got displayed instead so this proves that the pictures are all defaulting to (0, 0). The pictures do not go to their designated spots and that is what I am having trouble with.
***Side note: the functions "greyScale", "colorAvg", "colorSwap", and "lighten" should have nothing to do with the problem. I also don't think my "copy" function should be a problem either but I could be wrong.
I changed my copy function so that the parameters are (picture, destination, targX, targY)
Then in the copy function I made it:
targetX = targX
and then later
targetY = targY

Changing line transparency of a series without affecting marker transparency in Excel VBA

I am writing a macro in VBA for excel in which I would like to change the transparency of the lines connecting markers in a series but leave the transparency of the markers in the series the same.
To specify: the chart is a scatter plot. I would like the markers for a series to be opaque/zero transparency and for the lines in the series to be 75% transparent.
I have adjsuted the transparency of the lines by using
myseries.format.line.transparency = 0.75
but this changes the marker transparency as well.
does anyone know of a way I can change the transparency of the two separately? I imagine there is a member/property to do what I want, but I cannot find it.
thanks in advance for any help!
This answer isn't going to make you very happy.
I've looked into this before and the information i've gotten is that this simply isn't a parameter that you can specify through VBA. It looks like you can access marker style, size, background color and foreground color, and that's about it.
Maybe MS didn't think anyone would ever want to mess with that.
One thing you could try is applying a custom chart format, but if you have variable numbers and/or orders of series then that may not work.
mychart.ApplyChartTemplate ("filepath\filename.crtx")
Something like that, where mychart is already set equal to the chart you want to format.
Again, maybe not of any use to you, best i could think of.
You guys didn't dig hard enough.
SeriesCollection(i).Format.Line.Transparency
will work if the SeriesObject is in a certain state. The original 'automatic' line style state prevents this vba from doing anything at first, but if you simply precede it by setting certain other properties on the line format first, then the transparency will take. The following worked for me:
For Each obj In myChart.SeriesCollection
obj.Format.Line.DashStyle = 1
obj.Format.Line.Transparency = 0.65
Next obj
DashStyle = 1 sets the line style to 'Solid' (as opposed to dashed, dotted, etc.) and has the side effect of freeing up the series format to have the transparency set. I don't know for sure why it works, but it does.
Sorry, my mistake. I read the question slightly wrong.
I find that if I start the line with no markers, then turning transparency separately doesn't turn the markers on and off.
Try this:
activechart.SeriesCollection(1).format.fill.transparency=0.5