cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Can the Title of a plot be set by a variable

Youki
1-Newbie

Can the Title of a plot be set by a variable

Dear all,

Does anyone knows if we can set the titel of a plot with a variable.

Till now I change the plot titel in clicking on the plot area and changing the labels by hand.

I would like to have a solution where the label for the plot title is set by a variable without having to click on the plot area

Thank you

10 REPLIES 10
StuartBruff
23-Emerald II
(To:Youki)

Patrice Bujard wrote:

Dear all,

Does anyone knows if we can set the titel of a plot with a variable.

Till now I change the plot titel in clicking on the plot area and changing the labels by hand.

I would like to have a solution where the label for the plot title is set by a variable without having to click on the plot area

There's no direct way, AFAIK (don't know about M15 or Prime), but there are a couple of 'tricks' that you can use. Essentially, you define your title variable (:=), evaluate it (=) and then place the evaluated region on top of the plot. You can play around with using a different Math Style and a white font to make the variable 'invisible' or just put a 'white' region on top of the variable name. Won't work for the y-axis title.

You could also use a 3D plot component (inserted as an object not from the menu/toolbar) and use VBScript to modify the title attributes.

See attached worksheet for examples.

Stuart

RichardJ
19-Tanzanite
(To:Youki)

In additoin to Stuart's suggestions, there is one other approach. I have posted this worksheet (or an earlier version of it) before, but it didn't make it over from the old Collaboratory. It uses label components as titles.

StuartBruff
23-Emerald II
(To:RichardJ)

Richard Jackson wrote:

In additoin to Stuart's suggestions, there is one other approach. I have posted this worksheet (or an earlier version of it) before, but it didn't make it over from the old Collaboratory. It uses label components as titles.

I'd forgotten about that one, Richard. Sorry.

However, as partial compensation, it might be worth pointing out that if somebody likes it enough then they can right click on the component, choose 'Export as Component', save it as an .mcm file, copy it to the MCM folder in their Mathcad installation, then double-click it to register it (although I had to browse for mgmreg.exe after double-clicking - I also did it by double-click mgmreg.exe and then browsing to the component). This will (should) make the component directly available from the Insert Component wizard.

Stuart

RichardJ
19-Tanzanite
(To:StuartBruff)

I'd forgotten about that one, Richard. Sorry.

What? You can't remember absolutely everything that was posted on the Collab, including stuff that's over five years old? You must try harder!

http://communities.ptc.com/servlet/JiveServlet/showImage/38-1286-15586/Get+on+with+it!.gif

StuartBruff
23-Emerald II
(To:RichardJ)

Richard Jackson wrote:

I'd forgotten about that one, Richard. Sorry.

What? You can't remember absolutely everything that was posted on the Collab, including stuff that's over five years old? You must try harder!

http://communities.ptc.com/servlet/JiveServlet/showImage/38-1286-15586/Get+on+with+it!.gif

You know, some days you just can't win.

I've got you telling me to try harder,

My wife telling me that I'm trying enough as it is

And my little green friend saying "Do, or do not. There is no 'try.'"

http://images2.wikia.nocookie.net/__cb20070224213012/starwars/images/thumb/9/98/Yoda1280.jpg/220px-Yoda1280.jpg

MikeArmstrong
5-Regular Member
(To:RichardJ)

Nice example. Will defiantly come in handy.

Mike

MikeArmstrong
5-Regular Member
(To:Youki)

Another method. I have embedded an Excel component and passed the text string to it.

The one advantage this has is the format of the title can be edited in Excel and you can pass title to each of the axis.

Mike

Mike Armstrong wrote:

Another method. I have embedded an Excel component and passed the text string to it.

The one advantage this has is the format of the title can be edited in Excel and you can pass title to each of the axis.

Mike

And that's one of the reasons why I've advocated both worksheet-level control of plot component attributes and quote-less formattable strings.

Stuart

eg,

On 2/26/2005 3:57:09 AM, Stuart Bruff wrote:
...

would also give a method for introducing some of the other functionality that people have requested from time to time.

eg, I would like a plot to return its image and allow the user to set it's size or position.

If you just want to display a plot, use th...





















or from thread http://collab.mathsoft.com/read?88340,12 - Aug 06

[edited message to address ambiguity in original - it should refer to strings and not specifically text regions; change higlighted]

Whilst Mathcad's string
text handling allows the user to handle a large range of tasks, I find that it suffers from some deficiencies in use.

1. String wrapping: A large string has the same display problem that a large maths expression has - it doesn't wrap at the right margin. This makes it difficult to examine the string and gives extraneous pages when printing a worksheet (unless 'single page width' is selected, of course).

2. Double Quote: The double quote string delimiters can be distracting when displaying a string and detract from a 'document' appearance.

3. Fixed Plain Text Font: The string displays in a fixed plain-text font, which is not always suitable for displaying complex textual information, or mixing greek and latin characters.

I would like to see an enhanced string display and entry capability that would allow the user to enter and display multi-line, mixed font text with attributes, and have the ability to turn off display of the double quotes. Given Mathcad's XML based file structure, an HTML type display might prove a convenient of implementing such a facility.

The display region should have (user-selectable)auto push-down, and drag-size handles.

'formatted' strings (or at least as I view them) would be just ordinary strings that contain the formatting tags. The modifications just provide additional functionality, mainly in the display of strings, ie.

1). Active HTML/XML Display, eg:

formatted: x="underlined greek text in red is bold" (or minus the quotes)

or

2). Passive Display (plain text): x="<u>underlined</u> <FONT FACE="Symbol">greek</FONT> text in <FONT COLOR="#FF0000"<red>/FONT> is
<b>bold</b>" (which is what you get now).

Oh, and did I mention:

Conversion of a Mathcad expression to XML and vice versa?

MikeArmstrong
5-Regular Member
(To:StuartBruff)

I dislike the way Mathcad handles strings, the double quote string delimiters look horrible and make it virtually impossible to present a results table through Mathcad alone.

The new format for tables in Prime is nice, but I have just noticed it has a major flaw. Results cannot directly be passed to a results table in Prime and therefore the newly implemented feature in only good for defining variables, useless results tables.

Mike

Another method. I have embedded an Excel component and passed the text string to it.

The one advantage this has is the format of the title can be edited in Excel and you can pass title to each of the axis.

Sorry I have only just noticed that the example didn't attached.

Please see attached.

Mike

Top Tags