octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #66739] Reset Zoom is failing when at atomic l


From: anonymous
Subject: [Octave-bug-tracker] [bug #66739] Reset Zoom is failing when at atomic level sizes. Works usually 8.4.0
Date: Thu, 30 Jan 2025 14:33:50 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?66739>

                 Summary: Reset Zoom is failing when at atomic level sizes.
Works usually 8.4.0
                   Group: GNU Octave
               Submitter: None
               Submitted: Thu 30 Jan 2025 07:33:46 PM UTC
                Category: Plotting
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: None
             Assigned to: None
         Originator Name: TJ Fidler
        Originator Email: a3a04078@telus.net
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 9.2.0
        Operating System: Microsoft Windows
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 30 Jan 2025 07:33:46 PM UTC By: Anonymous
The following code that uses Reset Zoom usually works in GNU Octave 8.4.0,
Windows 10, but more often than not working in 9.2.0 or 9.3.0. Perhaps because
of the atomic scale :
fixed_limits = [-5.0e-11, 5.0e-11, -5.0e-11, 5.0e-11];
When moved the limits in the figure axis change to -6.0e9 to 6.0e9 versus
e-11

% Define radii and angles for the polar grid
polar_r_min = r_min; % Minimum radius
polar_r_max = r_max; % Maximum radius
polar_radii = polar_r_min:r_steps:polar_r_max; % Define radii based on the min
and max
polar_angles = 0:radial_change_deg:360; % Define angular divisions

% Create a matrix for visualization
polar_density_matrix = zeros(length(polar_radii), length(polar_angles)-1);
for i = 1:polar_deg_length
    for j = 1:polar_radial_width
        polar_density_matrix(j, i) = dataPolar1Array{i, j}(3); % Extract
density values
    end
end

% Create Figure 3
figure(3);
set(gcf, 'Position', [750, 100, 600, 440]);  % Set position of the first
figure
hold on;

% Find maximum density value for normalization
max_density = max(cellfun(@(x) x(3), dataPolar1Array(:)));

% Fill polar regions based on `dataPolar1Array` densities
for i = 1:polar_deg_length
    for j = 1:polar_radial_width
        % Extract density value for the current region
        density_value = dataPolar1Array{i, j}(3);

        if density_value > 0
            % Normalize density value to [0, 1]
            normalized_density = density_value / max_density;

            % Get the corners of the region
            r1 = r_min + (j * r_steps); % Outer radius
            r0 = r1 - r_steps;         % Inner radius
            theta_start = deg2rad((i-1) * radial_change_deg); % Start angle
            theta_end = deg2rad(i * radial_change_deg);       % End angle

            % Define the region coordinates for smooth curves
            theta_region = linspace(theta_start, theta_end, 100);
            x_region = [r0 * cos(theta_region), fliplr(r1 *
cos(theta_region))];
            y_region = [r0 * sin(theta_region), fliplr(r1 *
sin(theta_region))];

            % Fill the region with a color proportional to normalized density
            fill(x_region, y_region, [0, 0, normalized_density], 'EdgeColor',
'none'); % Blue gradient
        end
    end
end

% Draw the polar grid
% Concentric circles
for r = polar_radii
    theta_grid = linspace(0, 2 * pi, 360); % Full circle
    x_grid = r * cos(theta_grid);
    y_grid = r * sin(theta_grid);
    plot(x_grid, y_grid, 'k'); % Plot the circles
end

% Radial lines
for theta = deg2rad(polar_angles)
    x_line = [0, polar_r_max * cos(theta)];
    y_line = [0, polar_r_max * sin(theta)];
    plot(x_line, y_line, 'k'); % Plot the lines
end

% Set fixed axis limits to [-5.0e-11, 5.0e-11]
fixed_limits = [-5.0e-11, 5.0e-11, -5.0e-11, 5.0e-11];
axis(fixed_limits);
set(gca, 'XLim', fixed_limits(1:2), 'YLim', fixed_limits(3:4)); % Enforce axis
limits explicitly
daspect([1 1 1]); % Keep equal aspect ratio
grid on;
xlabel('X (m)');
ylabel('Y (m)');
title('Polar Grid with DataPolar1Array Densities');

% Add a reset button to restore axis limits
uicontrol('Style', 'pushbutton', 'String', 'Reset Zoom', ...
    'Position', [30, 20, 120, 30], ...
    'Callback', @(src, event) set(gca, 'XLim', fixed_limits(1:2), 'YLim',
fixed_limits(3:4)));

% Add a resize function to enforce axis limits when the figure is resized
set(gcf, 'resizefcn', @(src, event) set(gca, 'XLim', fixed_limits(1:2),
'YLim', fixed_limits(3:4)));

hold off;






    _______________________________________________________
File Attachments:


-------------------------------------------------------
Name: atomic_k_basedOn_20250119_goodStart_less_02_forUpload.m  Size: 13KiB
<https://file.savannah.gnu.org/file/atomic_k_basedOn_20250119_goodStart_less_02_forUpload.m?file_id=56835>

    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-9aa36b8aaaab70f75d4f4abb1d9f8d6bd3eed2b1.tar.gz

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66739>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]