Set graphics variables once, function graphics [message #92804] |
Wed, 02 March 2016 12:15  |
laura.hike
Messages: 87 Registered: September 2013
|
Member |
|
|
Hi,
I'm trying to make a set of plots that are slightly different using function graphics. Is there any way to set the various graphics properties once and have them apply to all of the plots (i.e., change the defaults)? I know how to use system variables for direct graphics, but so far have defined the properties over and over again for these plots and can't find a way to do otherwise.
Thanks!
|
|
|
Re: Set graphics variables once, function graphics [message #92807 is a reply to message #92804] |
Wed, 02 March 2016 17:23   |
dg86
Messages: 118 Registered: September 2012
|
Senior Member |
|
|
On Wednesday, March 2, 2016 at 3:15:19 PM UTC-5, laura...@gmail.com wrote:
> Hi,
>
> I'm trying to make a set of plots that are slightly different using function graphics. Is there any way to set the various graphics properties once and have them apply to all of the plots (i.e., change the defaults)? I know how to use system variables for direct graphics, but so far have defined the properties over and over again for these plots and can't find a way to do otherwise.
>
> Thanks!
You can define an anonymous structure that describes your style, and pass that
to function graphics routines using the _EXTRA mechanism
mystyle = {thick: 3, color: 'red', xtitle: 'happiness', ytitle: 'joy'}
p = plot( [0, 1], _extra = mystyle)
This way, you define your properties once (in the structure) and use them
in all of your plots.
All the best,
David
|
|
|
Re: Set graphics variables once, function graphics [message #92809 is a reply to message #92807] |
Thu, 03 March 2016 09:52   |
laura.hike
Messages: 87 Registered: September 2013
|
Member |
|
|
Thanks! It always baffles me how folks in this discussion group know all these little options.....
On Wednesday, March 2, 2016 at 8:23:54 PM UTC-5, David Grier wrote:
> On Wednesday, March 2, 2016 at 3:15:19 PM UTC-5, laura...@gmail.com wrote:
>> Hi,
>>
>> I'm trying to make a set of plots that are slightly different using function graphics. Is there any way to set the various graphics properties once and have them apply to all of the plots (i.e., change the defaults)? I know how to use system variables for direct graphics, but so far have defined the properties over and over again for these plots and can't find a way to do otherwise.
>>
>> Thanks!
>
> You can define an anonymous structure that describes your style, and pass that
> to function graphics routines using the _EXTRA mechanism
>
> mystyle = {thick: 3, color: 'red', xtitle: 'happiness', ytitle: 'joy'}
> p = plot( [0, 1], _extra = mystyle)
>
> This way, you define your properties once (in the structure) and use them
> in all of your plots.
>
> All the best,
>
> David
|
|
|
Re: Set graphics variables once, function graphics [message #92815 is a reply to message #92809] |
Fri, 04 March 2016 09:54  |
dg86
Messages: 118 Registered: September 2012
|
Senior Member |
|
|
On Thursday, March 3, 2016 at 12:52:12 PM UTC-5, laura...@gmail.com wrote:
> Thanks! It always baffles me how folks in this discussion group know all these little options.....
>
>
> On Wednesday, March 2, 2016 at 8:23:54 PM UTC-5, David Grier wrote:
>> On Wednesday, March 2, 2016 at 3:15:19 PM UTC-5, laura...@gmail.com wrote:
>>> Hi,
>>>
>>> I'm trying to make a set of plots that are slightly different using function graphics. Is there any way to set the various graphics properties once and have them apply to all of the plots (i.e., change the defaults)? I know how to use system variables for direct graphics, but so far have defined the properties over and over again for these plots and can't find a way to do otherwise.
>>>
>>> Thanks!
>>
>> You can define an anonymous structure that describes your style, and pass that
>> to function graphics routines using the _EXTRA mechanism
>>
>> mystyle = {thick: 3, color: 'red', xtitle: 'happiness', ytitle: 'joy'}
>> p = plot( [0, 1], _extra = mystyle)
>>
>> This way, you define your properties once (in the structure) and use them
>> in all of your plots.
>>
>> All the best,
>>
>> David
It's something to do with the inexorable passage of time.
Sigh.
|
|
|