I want to create a seaborn heatmap color scheme for bitcoin related stocks - heatmap

The maximum color hue s/b Hex: #f2a900 and minimum s/b white.
Using cmap="Oranges" gets me close but I want to change it so the maximum value is too the bitcoin color. Minimum could be white or pale yellow or even blue. Don't care about the minimum. It isn't a VMIN and VMAX setting.
Here is what is working for me but the Orange for a correlation of 1 is NOT #f2a900.
matrix_ddd = sns.heatmap(corr_matrix, cmap='Oranges') ## subset of the heatmap call.
The question "Seaborn Heatmap Custom colormap" is obviously close but I can not get it to work (newbee, eh).
So my question is how can I create a custom set of 8 colors ranging from #f2a900 (for max correlation) ranging down to say very pale yellow in say 8 steps. I did see the option to use a set of named colors but it doesn't let me specify #f2a900 -- that is we need a bit coin color.

Related

How to generate un-similar color palettes?

I'm going to draw a bunch of areas on the map. Each area should be of different color, preferably clearly different from the others. Of course, as the number of areas grows, I'm ducked. But until then I wonder where I could find or how I could generate a set of, say 15 colors that are "vastly" apart.
The first few were easy, because I used the defaults from Bootstrap:
blue
yellow
red
green
pink
But I can't stop wondering if there's a trick, tool or algorithm for generating a next, deviating color.
Googling gave me ways to generate similar schemas or colors that go well together. That's not what I'm looking for, though. Also, I discovered that there's much, muuuuch more to colors than mixing RGB, so I feel like a total looser noob.
You should indeed use the hsl 360 degrees to generate a well spread color spectrum. To have something like that in typescript/js you could do:
const length = 15;
const colors = Array.from({ length }, (_, i) => `hsl(${360 / length * i}, 50%, 50%)`);
Here you can see a working example:
stack
Result:

How to divide Hex Code colors to a minimal lost for the main colors family?

We are building a comparison website based on items scraped from the internet.
One of the main filters for the user's comparison engine is filtering by products by colors.
The issue is that we are scraping information from many different ecommerce and we get an endless list of colors with many strange names like CAPULET OLIVE or CHARCOAL RED.
So i was thinking if we can automatically get the hex color by comparing the a name-hex list maybe we can work with that.
Hence the hex is dividing the RGB to 16,777,216 colors(red 1-255 optionsGreen 1-255 optionsBlue 1-255 options). if there was a table somewhere that is dividing the options to the main 6-12 colors (ref, green, blue, yellw, etc.) that can work pretty well.
i.e.CAPULET OLIVE hes the hex value of #656344 which is R=101,G=99,B=68 in decimal.
if i had a table showing this range or strength of red and green vs blue is actually a form of green i can tag this model as green.
Basically, what i'm asking, is there a table that allocating all of the hex codes 6-12 main colors?
So i think i found a simple way to implement this using HSV color model.
Step 1-
Use a search website engine to find HSV/B code by name for sites like this:
https://rgb.to/color/17148/spearmint-green
http://www.perbang.dk/rgb/696B4D/
Step 2-
Use a predefined table to allocate color to his family, for example this one:
https://mehrarodgers.files.wordpress.com/2013/05/hue-scale.png
Though i found some missing color ranges there, so it can be improved.
This article is very useful in dividing the HSV by color wheel:
http://warrenmars.com/visual_art/theory/colour_wheel/evolution/evolution.htm

Targa image – damaged red and green channels

I've a problem with 16-bit targa file. I'm opening image and it colors are weird. It's problem with red and green channels – blue is fine.
How I can repair targa image, to look like on example? (first is original image, second is as must look.)
Image
EDIT: this answer gives results that look right, but won't be bit-identical to the original. Something weirder is going on.
You can make your corrupted image out of your original image by subjecting the red and green channels to a function that doubles the value, subject to wraparound:
F(r) = (r*2) % 255
F(g) = (g*2) % 255
These functions are not invertible, because more than one input value can map to the same output value. In particular,
F^-1(r) = {r / 2, r / 2 + 128}
But we can still try to recover the image if we're willing to tolerate some errors. We'll try to guess whether red (or green) should be high; if so, add 128.
Two pieces of information can guide our guess:
Is the blue channel high? Unless images contain strongly blue pixels, this is a hint that the red and green channels should be high, too.
Is there an adjacent pixel whose red (or green) channel is high, while this pixel's red channel is very low (say, less than 64)? This may suggest that both pixels are relatively bright, but this pixel's red channel got wrapped.
I recovered something very close to your original image using just the blue channel information to decide between r / 2 and r / 2 + 128, though it would probably be better using the neighboring pixels' red and green channels as well.
As a side note, one way this sort of problem could occur is if there were originally (say) 6 bits of red information, but only the least significant 5 bits were retained when the file was written. It would be useful to look at how these images were acquired to make sure that you're not chopping off the most significant bits of your R and G channels somehow.

Finding close colors of a given color

I´d like to know, how, through actionscript 3, to get an array of ARGB (hexadecimal) colors, that is close to a given color.
Example:
0xFF00FF00
A green.
How to get variations of green?
I´m trying to get some green colors of a bitmapdata.
I´ve tried to get it by making a loop getting the colors using getPixels32.
The problem is, I think the bits colors of each position are different from the bits of the bitmap rendered.
It´s for a pathfinder.
Each green bit sets a node in a map, as walkable.
So I need to know what are these colors to set it as walkable for the pathfinder.
Any suggestions?
RGB space is terrible for interpreting whether colors are similar to one another. A different color space that matches closer to human perception of color is HSV (hue saturation and value). Here are the steps you should follow:
Convert your value from RGB space to HSV (http://www.cs.rit.edu/~ncs/color/t_convert.html)
Modify the saturation and value to obtain different shades of the same green hue.
You can even modify the hue a little with a defined tolerance level you specify
Reconvert back to HSV to RGB
I believe technically..one color space is smaller than the other, meaning it is not always a 1:1 conversion - but it should serve your purpose.

Random Non-White Colors That Look Okay As Background for Black Text

I'd like to generate random, non-white colors using hue, saturation and brightness that can be used as a background for black text. I've created a generator for random colors, but when I scan the numbers, I can't see any clear pattern in the colors that look too dark.
How can I generate random non-white background colors for black text? Feel free to answer with code or pseudo-code, but it's definitely not necessary.
Only generate colors with high brightness values - for example, if you were using the range 0-255 for each of {H,S,V}, you'd generate H in [0,255], S in [0,255], V in [168,255]. That should give you colors that are bright enough. You may want to restrict saturation as well (e.g. S in [0,192]), since black on full-bright, full-saturation colors may not be very readable.
You'll probably need to play with the values to get ranges that will give you usable colors.
I don't know color theory, but you can try randomly generating the 3 components in RGB (xxx,xxx,xxx) in a way that the sum of the components is greater than X (X depends of the contrast you want), and the convert to HSB.
HSV and HSL are broken models than have nothing to do with perception. You should generate your colors in YUV space (also known as YCbCr) where the intensity (Y) channel is not simply R+G+B but rather models the perceptual intensities of red, green, and blue. A good starting point would be to try random Y values at least 200 and random U and V values between -50 and 50.