Of course I should also share the data here:
\n\nYou can load the data file like:
\nvar lines = File.ReadAllLines(\"values.txt\");\nvar length2 = lines[0].Split(',', StringSplitOptions.RemoveEmptyEntries).Length;\n\nvar values = new double[lines.Length, length2];\nfor(int i = 0; i < lines.Length; i++)\n{\n var split = lines[i].Split(',', StringSplitOptions.RemoveEmptyEntries);\n for(int j = 0; j < split.Length; j++)\n {\n values[i, j] = double.Parse(split[j]);\n }\n}Then the previous program will generate a image like:
\n\nIt seems 'ugly', but in general it's what a spectrum should be. However these horizontal lines are not expected:
\n\nI have also tried to manually modify the values (this change is included in the previous data file). But it doesn't work. (1 is the biggest value in the array. So there is expected to be a yellow line, but it's still blue.)
So... have I did something wrong? Thanks for help in advance.
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"It's a problem in my other steps... And... [511, 0] will be drawn to the bottom left corner (0, 0) rather than 0, 511
-
|
Hello! I'm using OxyPlot to draw the spectrums of some sound files. Actually they are just a kind of Plot plot = new();
var heatmap = plot.Add.Heatmap(values);
plot.Add.ColorBar(heatmap);
plot.SavePng("test.png", 10000, 10000);Of course I should also share the data here: You can load the data file like: var lines = File.ReadAllLines("values.txt");
var length2 = lines[0].Split(',', StringSplitOptions.RemoveEmptyEntries).Length;
var values = new double[lines.Length, length2];
for(int i = 0; i < lines.Length; i++)
{
var split = lines[i].Split(',', StringSplitOptions.RemoveEmptyEntries);
for(int j = 0; j < split.Length; j++)
{
values[i, j] = double.Parse(split[j]);
}
}Then the previous program will generate a image like: It seems 'ugly', but in general it's what a spectrum should be. However these horizontal lines are not expected: I have also tried to manually modify the So... have I did something wrong? Thanks for help in advance. |
Beta Was this translation helpful? Give feedback.
-
|
It's a problem in my other steps... And... |
Beta Was this translation helpful? Give feedback.
It's a problem in my other steps... And...
[511, 0]will be drawn to the bottom left corner (0, 0) rather than0, 511