Tag Info

Hot answers tagged

15

I wrote the ColorBar package exactly for this purpose and it makes such modifications easy. The README.m should give you all the instructions you need, but I'll summarize it here. After installing the package (copy ColorBar.m to FileNameJoin[{$UserBaseDirectory, "Applications"}]), do the following: ColorBar["TemperatureMap"] Now you can click on the ...


6

I answered this question for indexed color schemes here: How to change element color in Periodic Table? The gradient color schemes have a simpler structure, e.g.: However it seems unclear to me what the desirable semantics of a general function for gradient schemes would be. I think from your description that you wish to replace an existing color ...


5

Another way to draw rectangles using Graphics: Graphics[MapThread[{#2, Rectangle[#1, #1 + π/8]} &, {angles, colours}]]


5

ListPlot[MapIndexed[Style[#, colours[[#2]], PointSize[.1]] &, angles], AspectRatio -> 1] or ListPlot[Style[#, #2, PointSize[.1]] & @@@ Transpose[{angles, colours}], AspectRatio -> 1] Update: make those circles into squares, and make them all fill up the plot? As in no spaces between each one ArrayPlot[Transpose@Partition[colours, ...


4

Update: Using EventHandler and TemperatureMap: image = Import["http://i.stack.imgur.com/qmKND.png"]; DynamicModule[{col = Green}, EventHandler[Column[{ColorData["TemperatureMap", "Image"], Dynamic@Colorize[image, ColorRules -> {0 -> White, 1 -> col}, ImageSize -> 300]}], {"MouseClicked" :> (col = ...


4

Use colors=(("DefaultPlotStyle"/.(Method /. Charting`ResolvePlotTheme["Scientific" , ListLinePlot]))/. Directive[x_,__]:>x) to get the colors used in the "Scientific" plot theme. Then use colors as the first argument of LineLegend: Column[{ Row[{Style["Data from experiment 5B", FontFamily -> "Times", FontSize -> 12]}, Alignment -> ...


3

Your second solution can be improved by Evaluate[] on the first plot argument. Plot[Evaluate[y /. sol], {x, -10, 10}, PlotLegends -> Automatic]


3

To me it looks like there is a bug in the Implementation of BarLegend. When the the number of contours increases there is not only a switch from discrete contours to a continuous gradient (this behavior is documented), but also a change in the scaling (that's the bug). colorf = Blend[{{0, Red}, {20, Yellow}, {40, Green}}, Round[#, 0.1]] &; ...


3

I guess the crucial point in your question is how to combine the images. When I look at the IDL output image, I guess that what IDL does is to assume that black is transparent when combining two images. It looks to me as if the red points are completely drawn over other colors which suggests that this was the last image layer that was added. Let me give a ...


2

Here is a revision that (maybe) combines things as you ask. The SetAlphaChannel command makes the black pixels clear in each of the images. Now you can combine the images directly using Show, and the order of precedence in the colors is given by the order in which they appear in the Show command. rchan = Import["http://i.stack.imgur.com/ruNFL.png"]; gchan = ...


2

The main culprit for the slowness is the presence of a couple of lines like this in the internal implementation of ReplacePixelValue: coords = DeleteDuplicates[coords, {}]; I have not seen this usage of an empty list in the second argument of DeleteDuplicates and have no idea what it is supposed to do. It is very slow though. If we temporarily redefine ...


2

One way to speed things up is to get the ImageData and work with that directly. A simple rule can give you your result: Image[ImageData@bin /. {1 -> {1, 0, 0}, 0 -> {0, 0, 0}}] This takes 0.1 seconds on my computer compared to 2 seconds for the ReplacePixelValue version. Yes there is a difference between ReplaceImageValue and ReplacePixelValue. ...


2

To find a good binarization value, you can quickly scan through all the values. It's very quick. img = Import["http://i.stack.imgur.com/natsI.png"] Manipulate[Binarize[img, t], {t, 0, 1}] You can make it red this way: z = ImageMultiply[img, 0]; Manipulate[ColorCombine[{Binarize[img, t], z, z}], {t, 0, 1}]


2

Blend was modified in version 10. It appears that Blend is now scaled to {0, 1}. colorf = Blend[{{0, Red}, {0.5, Yellow}, {1, Green}}, Round[#, 0.01]] &; BarLegend[{colorf, {0, 30}}]


2

I reproduce what you observe in version 10.0.1 under Win7 x64: the on-screen appearance of the glyphs in tick labels and frame labels changes considerably after addition of ColorFunction (which introduces VertexColors into Graphics generated by RegionPlot). Here is the code I used to check the on-screen appearance: pl1 = RegionPlot[ x + 0.45 y >= 122. ...


1

$Version "9.0 for Mac OS X x86 (64-bit) (January 24, 2013)" max = 40; funcs = #*x & /@ Range[max]; plt = Plot[funcs, {x, 0, 1}, PlotStyle -> Black, Filling -> (Partition[Range[max], 2, 1] /. {a_, b_} :> a -> {b})]; The filling colors between the plots are expressed in "HSB", i.e., Hue[{hue, saturation, brightness}] clr ...


1

I believe it's the same, but with Opacity[0.2]. (Also, since Mathematica 10 it's ColorData[97] instead of ColorData[1].)


1

This is not another answer but rather an extension of kguler's correct response. Further issues are also identified. In order to help use kguler's answer I have made a function which may be useful to others. ClearAll[plotColors]; plotColors::usage = "plotColors[plotType,plotTheme] gives a list of the colors used in \ a plot when several curves are ...


1

MatrixPlot[RandomReal[{1, 4}, {10, 10}], PlotLegends -> BarLegend[{ColorData[{"Temperature", {1, 4}}], {1, 4}}], ColorFunction -> (ColorData[{"Temperature", {1, 4}}]), ColorFunctionScaling -> False, DataReversed -> True] Version 9.0.1.0: Version 10.0.1.0 (Wolfram Programming Cloud): Update: PlotLegends -> ...



Only top voted, non community-wiki answers of a minimum length are eligible