PatrickT

Dr. Patrick T

2103 Reputation

18 Badges

15 years, 88 days

MaplePrimes Activity


These are replies submitted by PatrickT

@wingjammer 

Oh I misread your questions. I don't think there's a simple way, none that is documented.

You could produce a postscript and then alter it with procedure, but that would be tedious.

@Carl Love 

Thanks, I see, excellent, thanks!

@Carl Love 

Thanks, I see, excellent, thanks!

@Alejandro Jakubi 

 

Thanks Alejandro for this explanation. I get it!

@Alejandro Jakubi 

 

Thanks Alejandro for this explanation. I get it!

Thanks Carl, that's great.

I hadn't used subsindets in a while and had basically forgotten about it. It's amazingly powerful, I should use it more often. The use of thisproc inside subsindets is very neat.

Thanks Carl, that's great.

I hadn't used subsindets in a while and had basically forgotten about it. It's amazingly powerful, I should use it more often. The use of thisproc inside subsindets is very neat.

I was looking for just that. It is surprising that Maple's round command only returns integers, considering that the related trunc command does return floats. 

The Round procedure below has arguments in the reverse order as trunc, because Maple complained that the optional parameter n cannot appear first. It's okay with me, as I probably prefer to have the optional parameter in second position.

restart;
Round := proc(x,n::integer:=1)
   parse~(sprintf~(cat("%.",n,"f"),x)); 
end proc:

# Testing
L := [1.23456789, 9.87654321]:

Round(L,3);

[1.235, 9.877]

Round(L[1]);
 
1.2

I was looking for just that. It is surprising that Maple's round command only returns integers, considering that the related trunc command does return floats. 

The Round procedure below has arguments in the reverse order as trunc, because Maple complained that the optional parameter n cannot appear first. It's okay with me, as I probably prefer to have the optional parameter in second position.

restart;
Round := proc(x,n::integer:=1)
   parse~(sprintf~(cat("%.",n,"f"),x)); 
end proc:

# Testing
L := [1.23456789, 9.87654321]:

Round(L,3);

[1.235, 9.877]

Round(L[1]);
 
1.2

you're absolutely right Carl, thanks!

In fact, Joe's code was correctly dividing by 255.0, I didn't look close enough  :-(

COLOUR(RGB,op(ColorTools:-HexToRGB24(color))/255.0)

you're absolutely right Carl, thanks!

In fact, Joe's code was correctly dividing by 255.0, I didn't look close enough  :-(

COLOUR(RGB,op(ColorTools:-HexToRGB24(color))/255.0)

I would like to recolor a list of plots using Maple default values. I have produced a list of colors with the plots:-setcolors(default) command. However, the colors are returned as a list of Hex values.  I first converted the Hex values to RGB values and then attempted to adapt a procedure written by Joe Riel, named -recolor- (refer to Joe's answer from which this question is branched).

But I must have done something wrong.

The conversion from Hex to RGB seems to work fine, but the plot does not return the expected colors.


restart;
# procedure to recolor each plot, adapted (incorrectly?) from Joe Riel's procedure
recolor := proc(p, color) # takes Hex values as input
subsindets(p
, 'specfunc(anything, {COLOR, COLOUR})'
, clr -> COLOUR(RGB,op(ColorTools:-HexToRGB24(color))) # convert Hex values to RGB values
)
end proc:

# obtain the default list of colors
colorlist := plots:-setcolors(default);
["#78000E", "#000E78", "#4A7800", "#3E578A", "#780072", 

"#00786A", "#604191", "#004A78", "#784C00", "#91414A",

"#3E738A", "#78003B", "#00783F", "#914186", "#510078", "#777800"

]

map(x->ColorTools:-HexToRGB24(x),colorlist);

[[120, 0, 14], [0, 14, 120], [74, 120, 0], [62, 87, 138],

[120, 0, 114], [0, 120, 106], [96, 65, 145], [0, 74, 120],

[120, 76, 0], [145, 65, 74], [62, 115, 138], [120, 0, 59],

[0, 120, 63], [145, 65, 134], [81, 0, 120], [119, 120, 0]]
The mapping from Hex to RGB seems to work properly. However, the plots produced do not display the correct colors.

N := 10: # number of plots to draw

# Attempt at Recoloring:
p := [ seq( plot(x^i, x=0..1), i = 1..N ) ] :
plots:-display(p) ;

plots:-display( recolor~( p, colorlist[1..N]) ) ;
 
# Expected Output

p := [ seq( plot(x^i, x=0..1, 'color' = colorlist[i]), i = 1..N ) ] :
plots:-display(p) ;

that's a great reference to have, thanks Alejandro!

that's a great reference to have, thanks Alejandro!

@Carl Love 

It would be great to have a webpage with a correspondence between the character display and its 1d notation. I vaguely remember acer explaining how to obtain them by using the palette and the mouse, which is how I got the star above. We would all love to have such a reference page I'm sure. No-one wants to have to use the mouse, do they?

[anecdote about mouses: former French president, Chirac, circa 1995, at a computer fair asked "so which one is the mouse?" and it became a famous phrase, where mouse was usually replaced by rat]

1 2 3 4 5 6 7 Last Page 2 of 93