How to draw a graph of an image with frequency in y axis and pixel value in x axis in matlab?
    4 ビュー (過去 30 日間)
  
       古いコメントを表示
    
How to draw a graph of an image with frequency in y axis and pixel value in x axis in matlab?
採用された回答
  Image Analyst
      
      
 2015 年 7 月 26 日
        % Extract the individual red, green, and blue color channels.
redChannel = secret(:, :, 1);
greenChannel = secret(:, :, 2);
blueChannel = secret(:, :, 3);
[pixelCountsR, grayLevelsR] = imhist(redChannel);
[pixelCountsG, grayLevelsG] = imhist(greenChannel);
[pixelCountsB, grayLevelsB] = imhist(blueChannel);
plot(grayLevelsR, pixelCountsR, 'r-', 'LineWidth', 2);
hold on;
plot(grayLevelsG, pixelCountsG, 'r-', 'LineWidth', 2);
plot(grayLevelsB, pixelCountsB, 'r-', 'LineWidth', 2);
grid on;
fontSize = 20;
ylabel('Frequency', 'FontSize', fontSize);
xlabel('Pixel Value', 'FontSize', fontSize);
Then just do the same for share. Then you can use text() and annotation() to add text labels and arrows wherever you want them. Or you can use legend().
3 件のコメント
  Image Analyst
      
      
 2015 年 8 月 21 日
				Anushka:
Try this:
x = 0:255;
y = 0.0018 * rand(1, length(x));
plot(x, y, 'b-');
ax = gca;
ax.XTick = 0:50:250;
yTicks = 0:.0002:.0018;
ax.YTick = yTicks;
for k = 1 : length(yTicks)
  YTickLabels{k} = sprintf('%.4f', yTicks(k));
end
ax.YTickLabels = YTickLabels;
その他の回答 (1 件)
参考
カテゴリ
				Help Center および File Exchange で Axis Labels についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

