[plotting] object way of editing plot properties

This commit is contained in:
2019-11-28 16:56:26 +01:00
parent 2e0b2a5239
commit 19983392c5
6 changed files with 150 additions and 93 deletions

View File

@@ -1,10 +1,12 @@
time = 0.0:0.001:1.0;
y = sin(2 * pi * 2 .* time);
figure
hold on
set(gcf, 'Color', 'white', 'PaperUnit', 'centimeters', 'PaperSize', [4 4], ...
'PaperPosition', [0 0 4 4])
fig = figure();
fig.PaperUnits = 'centimeters';
fig.PaperSize = [4 4];
fig.PaperPosition = [0.0 0.0 4, 4];
fig.Color = 'white';
plot(time, y)
plot([0.0 1.0], [0.0 0.0], '--', 'color','k', 'linewidth', 0.75)

View File

@@ -1,26 +1,40 @@
load('pyramidal_response.mat')
threshold = 20; % mV
hold on
hold on;
plot(time*1000.0, neuronal_data, 'color', [0.2 0.5 0.7], ...
'linewidth', 1., 'displayname', 'Membrane voltage')
'linewidth', 1., 'displayname', 'Membrane voltage');
plot(spikes*1000.0, ones(size(spikes)) .* threshold, 'r.', ...
'markersize', 15, 'displayname', 'Spike times')
'markersize', 15, 'displayname', 'Spike times');
line([time(1) time(end)], [threshold threshold], 'linestyle', '--', ...
'linewidth', 0.75, 'color', [0.5 0.5 0.5], 'displayname', 'Threshold')
'linewidth', 0.75, 'color', [0.5 0.5 0.5], 'displayname', 'Threshold');
xlabel('Time [ms]', 'fontname', 'times', 'fontsize', 11)
ylabel('Potential [mV]', 'fontname', 'times', 'fontsize', 11)
title('ELL pyramidal neuron', 'fontname', 'times', 'fontsize', 12)
ylim([0 40])
xlim([500 1700])
box('off')
l = legend(gca,'show');
set(l,'location','northeast', 'fontsize', 11, 'linewidth', 1.);
set(gca, 'xminortick','on','yminortick','on')
set(gca, 'tickdir','out', 'linewidth', 1.5, 'fontname', 'times', ...
'fontsize', 11)
set(gcf, 'paperunits', 'centimeters', 'papersize', [15 7]);
set(gcf, 'paperposition',[0.0 0.0 15, 7], 'color', 'white')
axes = gca();
axes.XLabel = 'Time [ms]';
axes.YLabel = 'Potential [mV]';
axes.Title = 'ELL pyramidal neuron';
axes.XLim = [[500 1700];
axes.YLim = [0 40];
axes.XMinorTick = 'on';
axes.YMinorTick = 'on';
axes.TickDir = 'out';
axes.LineWidth = 1.5;
axes.box('off')
saveas(gcf, 'spike_detection.pdf', 'pdf')
axes.FontName = 'Times';
axes.FontSize = 8;
axes.TitleFontSizeMultiplier = 1.5;
axes.LabelFontSizeMultiplier = 1.25;
l = legend(axes, 'show');
l.Location = "northeast";
l.FontSize = 11;
l.LineWidth = 1;
fig = gcf();
fig.PaperUnits = 'centimeters';
fig.PaperSize = [15, 7];
fig.PaperPosition = [0.0 0.0 15, 7];
fig.Color = 'white';
saveas(gcf, 'spike_detection.pdf', 'pdf')

View File

@@ -11,8 +11,11 @@ err_upper_asym = prctile(asym_data, 75, 1);
err_lower_asym = prctile(asym_data, 25, 1);
fig = figure();
set(fig, 'paperunits', 'centimeters', 'papersize', [15 6.5], ...
'paperposition', [0.0 0.0 15, 6.5], 'color', 'white')
fig.PaperUnits = 'centimeters';
fig.PaperSize = [15 6.5];
fig.PaperPosition = [0.0 0.0 15, 6.5];
fig.Color = 'white';
subplot(1,3,1)
errorbar(x_data, avg_sym, err_sym, 'marker', 'o')
xlim([-.5, 6.5])

View File

@@ -7,9 +7,11 @@ f_y = 1.5;
dt = 2*pi/500;
f = figure();
set(f, 'visible', 'off');
set(f, 'PaperUnits', 'centimeter', 'PaperSize', [2.5, 2.5], ...
'PaperPosition', [0, 0, 2.5, 2.5], 'Color', 'white')
f.Visible = false;
f.PaperUnits = 'centimeters';
f.PaperSize = [2.5 2.5];
f.PaperPosition = [0.0 0.0 2.5, 2.5];
f.Color = 'white';
writer = VideoWriter('../lecture/images/lissajous.mp4', 'MPEG-4');
writer.FrameRate = 25;
@@ -40,8 +42,10 @@ for i = 1:max_frames
end
f = figure();
set(f, 'PaperUnits', 'centimeter', 'PaperSize', [5, 5], ...
'PaperPosition', [0, 0, 5, 5], 'Color', 'white')
f.PaperUnits = 'centimeters';
f.PaperSize = [2.5 2.5];
f.PaperPosition = [0.0 0.0 2.5, 2.5];
f.Color = 'white';
scatter(x_positions, y_positions, 10, 'r', 'filled');
xlim([-1.05, 1.05])
@@ -51,4 +55,4 @@ yticks([-1., 0., 1.])
xlabel('x')
ylabel('y')
saveas(f, '../lecture/images/lissajous.png')
saveas(f, '../lecture/images/lissajous.png')

View File

@@ -1,5 +1,5 @@
frequency = 5; % frequency of the sine wave in Hz
time = 0.01:0.01:1.0; % the time axis
time = 0.01:0.01:1.0; % the time axis in seconds
signal = sin(2 * pi * time * frequency);
plot(time, signal);