Datei:NPVIC participants.svg
Originaldatei (SVG-Datei, Basisgröße: 990 × 765 Pixel, Dateigröße: 264 KB)
Diese Datei und die Informationen unter dem roten Trennstrich werden aus dem zentralen Medienarchiv Wikimedia Commons eingebunden.
Beschreibung
BeschreibungNPVIC participants.svg |
English: Graph illustrating the history of U.S. state participation in the National Popular Vote Interstate Compact. Created with a MATLAB script and converted from PDF to SVG using Inkscape. |
Datum | |
Quelle | Eigenes Werk. |
Urheber | Swpb. |
SVG‑Erstellung InfoField |
Lizenz
- Dieses Werk darf von dir
- verbreitet werden – vervielfältigt, verbreitet und öffentlich zugänglich gemacht werden
- neu zusammengestellt werden – abgewandelt und bearbeitet werden
- Zu den folgenden Bedingungen:
- Namensnennung – Du musst angemessene Urheber- und Rechteangaben machen, einen Link zur Lizenz beifügen und angeben, ob Änderungen vorgenommen wurden. Diese Angaben dürfen in jeder angemessenen Art und Weise gemacht werden, allerdings nicht so, dass der Eindruck entsteht, der Lizenzgeber unterstütze gerade dich oder deine Nutzung besonders.
- Weitergabe unter gleichen Bedingungen – Wenn du das Material wiedermischst, transformierst oder darauf aufbaust, musst du deine Beiträge unter der gleichen oder einer kompatiblen Lizenz wie das Original verbreiten.
Es ist erlaubt, die Datei unter den Bedingungen der GNU-Lizenz für freie Dokumentation, Version 1.2 oder einer späteren Version, veröffentlicht von der Free Software Foundation, zu kopieren, zu verbreiten und/oder zu modifizieren; es gibt keine unveränderlichen Abschnitte, keinen vorderen und keinen hinteren Umschlagtext.
Der vollständige Text der Lizenz ist im Kapitel GNU-Lizenz für freie Dokumentation verfügbar.http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
Matlab code
%========================================================================== % PPRODUCES A LABELED AREA PLOT OF THE ENACTMENT HISTORY OF THE NPVIC % Author: Swpb % Date: 4-Apr-2014 %========================================================================== clear all; %========================================================================== % !!! ADD EVENTS HERE !!! Events = [ % STATE EVs DATE { ' ' 0 '19-Jan-2006' }; %(First legislative introduction) { 'MD' 10 '10-Apr-2007' }; { 'NJ' 14 '13-Jan-2008' }; { 'IL' 20 ' 7-Apr-2008' }; { 'HI' 4 ' 1-May-2008' }; { 'WA' 12 '28-Apr-2009' }; { 'MA' 11 ' 4-Aug-2010' }; { 'DC' 3 ' 7-Dec-2010' }; { 'VT' 3 '22-Apr-2011' }; { 'CA' 55 ' 8-Aug-2011' }; { 'RI' 4 '12-Jul-2013' }; { 'NY' 29 '15-Apr-2014' }; %{ 'state' EVs 'date' }; %Add new events above this line in the format shown ]; % =====Display Options ===== right_edge_gap = false; %Set to true to display recent events properly clr1 = [0.4 0.9 0.4]; %Area plot face color (RGB) clr2 = [0.0 0.5 0.0]; %"Total" line color backc = [1.0 1.0 0.8]; %Label background color shadowc=[0.8 0.8 0.8]; %Label shadow color altyrc =[.97 .97 .97]; %Alternate year stripe color % ---------------------------------------------------------- %OLD EV values (move here after each reapportionment and update code below) % i MD NJ IL HI WA MA DC EVs_old1 = [0 10 15 21 04 11 12 03]; %values before 2010 reapportionment %EVs_old2 = ; %========================================================================== %CALCULATIONS %Extract data states = Events(2:end,1); dates = datenum(Events(:,3)')'; event_count = length(dates); evs = Events(:,2); for i=1:size(Events,1) EVs(i)=evs{i,1}; end date_0 = datenum(' 1-Jan-2006'); date_n = datenum(date); %start and end dates date_c = datenum('31-Dec-2010'); %census reapportionment date %Add census (or dummy) event to each state's column dates2 = zeros(size(dates,1)+1,event_count); for state=1:event_count if dates(1,state) < date_c %if state's first event is before census dates2(:,state) = sort([dates(:,state) date_c]); %insert date of census event else dates2(:,state) = sort([dates(:,state) dates(1,state)]); %else duplicate date of first event end end; dates = dates2; %Create column of sorted event dates event_list = unique(reshape(dates,size(dates,1)*size(dates,2),1)); %column of unique event dates event_list = sort([date_0; event_list; event_list; date_n]); %double entries, add start/end dates, and sort %Generate EV_mat matrix for area plotting EVs = [EVs_old1 zeros(1,length(EVs)-length(EVs_old1)); EVs]; %combine EV numbers into a matrix EV_mat = zeros(length(event_list),event_count); for state=1:event_count %for each state, generate a column of EV values at each event date index0 = find(event_list == dates(1,state),1); %index prior to first event EV_mat(1:index0,state) = zeros(index0,1); %zero prior to first event for event = 2:size(dates,1) index0 = find(event_list == dates(event-1,state),1); %index prior to previous event index1 = find(event_list == dates(event,state),1); %index prior to current event EV_mat(index0+1:index1,state) = EVs(event-1,state); %prior to subsequent dates end EV_mat(index1+1:end,state) = EVs(end,state); %to end date end total = sum(EV_mat,2); %total EVs following each event %========================================================================== %SET AXIS AND FIGURE PROPERTIES %Set right edge value if not(exist('right_edge_gap')) right_edge_gap = 0; end date_f = date_n+right_edge_gap*0.01*(date_n-date_0); %Set top edge value ymax = 20*ceil(total(end)/20)+5; %Set x-axis tick positions years = 0; while datenum(['1-Jan-' num2str(year(date_0)+1+years)]) < date_f years = years + 1; end str(1:years+1) = {'1-Jan-'}; grid_x_pos = datenum([char(str) num2str((year(date_0):year(date_0)+years)')]); %Set text for x-axis tick labels spaces = [' ']; x_labels_num = [year(date_0):year(date_f)]; for i=1:length(x_labels_num) x_labels(i,:) = [spaces '’' strrep(num2str(x_labels_num(i)),'20','')]; end if year(date_f) > year(date_f-90) %if date_f is in first part of the year x_labels(length(x_labels),:) = [spaces ' ']; %hide label for current year end %Prepare figure for plotting close all; figure(1); hold on; axis([date_0 date_f 0 ymax]); set(gcf,'Position',[100,150,1180,800],... %window (left, bottom, width, height) 'Color',[.98 .98 .98]); set(gca,'OuterPosition',[-.07,0.05,0.97,0.9],... %axes (left, bottom, width, height) 'Color',altyrc,'TickDir','out','FontSize',18,'YAxisLocation','right',... 'XAxisLocation','top','XTick', grid_x_pos,'XTickLabel',x_labels,'YTick',0:25:ymax); %,'XGrid','on','GridLineStyle',':' %set(gca,'OuterPosition',[-.07,-0.05,0.97,1.0],... %axes (left, bottom, width, height) % 'Color',altyrc,'TickDir','out','FontSize',18,'YAxisLocation','right',... % 'XAxisLocation','top','XTick', grid_x_pos,'XTickLabel',x_labels,'YTick',0:25:ymax); %,'XGrid','on','GridLineStyle',':' %========================================================================== %PLOT ELEMENTS %Draw solid background rectangle('position',[date_0 0 date_f-date_0 ymax],'Facecolor','white'); %Draw stripes on alternating years for yr = 2:2:years+1 %rectangle('position',[grid_x_pos(yr) 0 365.25 ymax-0.5],'Facecolor',altyrc,'LineStyle','none'); patch([grid_x_pos(yr) grid_x_pos(yr) grid_x_pos(yr)+365.25 grid_x_pos(yr)+365.25],[0 ymax ymax 0],altyrc,'EdgeColor',[.5 .5 .5]); end %Label x-axis text((date_0+date_f)/2,1.1*ymax,{'Year'},'FontWeight','demi',... 'FontSize',18,'Rotation',0,'HorizontalAlignment','center','VerticalAlignment','middle') %Label y-axis text(date_f+0.15*(date_f-date_0),ymax/2,{'Total' 'Electoral' 'Votes of' 'Adoptive' 'States'},'FontWeight','demi',... 'FontSize',18,'Rotation',0,'HorizontalAlignment','center','VerticalAlignment','middle'); %Plot data area(event_list,EV_mat,'FaceColor',clr1,'LineWidth',1,'EdgeColor','white'); %Determine positions of events event_x_pos = event_list(2:2:end-1); event_y_pos = total(3:2:end); %get x and y positions event_y_pos = max(event_y_pos, [0; event_y_pos(1:end-1)] ); %bump up y-positions on decreases lx0 = event_x_pos(1); ly0 = event_y_pos(1); %identify start position %Plot reapportionment line census_index = find(event_x_pos==date_c,1); %get index of census event in sequence of dates lxc = event_x_pos(census_index); lyc = event_y_pos(census_index); %identify census event position %plot([lxc lxc],[0 lyc],':','Color',(clr1+1)./2); plot([lxc lxc],[0 lyc],':','Color','black','LineWidth',2); %Plot "total" line plot(event_list(2:end), total(2:end), 'LineWidth',3,'Color',clr2); plot(event_list(5:end-1), total(5:end-1),'s-','LineWidth',3,'Color',clr2,'MarkerSize',4,'MarkerEdgeColor','none','MarkerFaceColor',clr2); %Plot a thickened plot border plot([date_0 date_f date_f],[0 0 ymax],'k','LineWidth',1); plot([date_0 date_0 date_f],[0 ymax ymax],'k','LineWidth',2); %========================================================================== %ADD LABELS %Set label formats and adjustments alength = ones(1,event_count+1); %length of anchor lines alength(4)=1.8; %adjustment for HI alength(7)=1.8; %adjstment for DC alength(8)=2.8; %adjustment for VT talgn(1:event_count)={'right '}; %horizontal text alignment xshad = .003*(date_f-date_0); %shadow x-displacement yshad = -.004*ymax; %shadow y-displacement vertp = alength*0.04*ymax; %adjust scale of vertical lines horzp = alength*0.01*(date_f-date_0); %adjust scale of horizontal lines %Label state event dates state_event_x_pos = event_x_pos([2:census_index-1 census_index+1:end]); %state events only state_event_y_pos = event_y_pos([2:census_index-1 census_index+1:end]); %state events only for n=1:length(state_event_x_pos) %for each state, plot box shadows lxn = state_event_x_pos(n); lyn = state_event_y_pos(n); text(lxn-horzp(n)+xshad,lyn+vertp(n)+yshad,states(n,:),'VerticalAlignment','bottom',... 'BackgroundColor',shadowc,'HorizontalAlignment',char(talgn(n)),'FontSize',15,'EdgeColor',shadowc,'Color',shadowc); %box shadow end for n=1:length(state_event_x_pos) %for each state, plot label boxes and lines lxn = state_event_x_pos(n); lyn = state_event_y_pos(n); plot([lxn-horzp(n) lxn],[lyn+vertp(n) lyn],'k-'); %line text(lxn-horzp(n),lyn+vertp(n),states(n,:),'VerticalAlignment','bottom',... 'BackgroundColor',backc,'HorizontalAlignment',char(talgn(n)),'FontSize',15,'EdgeColor','black'); %text box end %{ %Annotate start date [currx curry]=dsxy2figxy(gca,lx0,ly0); annotation('textarrow',[currx currx],[curry+0.06 curry],'LineWidth',1.5,'String',{'First' 'legislative' ' introduction '},... 'HorizontalAlignment','center','FontSize',12,'TextBackgroundColor',[.85 .95 1],'TextEdgeColor',[0 0 0],'FontWeight','demi'); %Annotate census event [currx curry]=dsxy2figxy(gca,lxc,lyc); [null topy]=dsxy2figxy(gca,0,ymax) annotation('textarrow',[currx currx],[0.9*topy curry],'LineWidth',1.5,'String',{' Reapportionment ' 'based on' '2010 Census'},... 'HorizontalAlignment','center','FontSize',12,'TextBackgroundColor',[.85 .95 1],'TextEdgeColor',[0 0 0],'FontWeight','demi'); %} %Annotate start date [startx starty]=dsxy2figxy(gca,lx0,ly0); annotation('textarrow',[startx startx],[starty-0.05 starty],'LineWidth',1.5,'String',{'First' 'legislative' ' introduction '},... 'HorizontalAlignment','center','FontSize',12,'TextBackgroundColor',[.85 .95 1],'TextEdgeColor',[0 0 0],'FontWeight','demi'); %Annotate census event [censx censy]=dsxy2figxy(gca,lxc,lyc); [null topy]=dsxy2figxy(gca,0,ymax); annotation('textarrow',[censx censx],[starty-0.05 starty],'LineWidth',1.5,'String',{' Reapportionment ' 'based on' '2010 Census'},... 'HorizontalAlignment','center','FontSize',12,'TextBackgroundColor',[.85 .95 1],'TextEdgeColor',[0 0 0],'FontWeight','demi'); %Annotate current EV total [currx curry]=dsxy2figxy(gca,date_n,total(end)); annotation('textarrow',[currx+.02 currx],[curry curry],'Color',clr2,... 'String',[' ' num2str(total(end)) ' (' num2str(round(total(end)/2.7)) '% of 270)'],'FontSize',15,'FontWeight','bold'); %========================================================================== %EXPORT AS PDF orient landscape print NPVIC_participants.pdf -painters -dpdf orient portrait %close(gcf) %========================================================================== %DISPLAY INTRUCTIONS TO CONVERT TO SVG clc; disp([ ... ' TO CONVERT PDF TO SVG USING INKSCAPE: '; ' 1. Open NPVIC_participants.PDF in inkscape '; ' 2. Select all (Ctrl-A) '; ' 3. Path -> Object to Path (Ctrl-Shift-C) '; ' 4. Path -> Stroke to Path (Ctrl-Alt-C) '; ' 5. Save as Plain SVG '; ]); %========================================================================== %End of code
In dieser Datei abgebildete Objekte
Motiv
Einige Werte ohne einen Wikidata-Eintrag
14. Juni 2011
Dateiversionen
Klicke auf einen Zeitpunkt, um diese Version zu laden.
Version vom | Vorschaubild | Maße | Benutzer | Kommentar | |
---|---|---|---|---|---|
aktuell | 18:54, 12. Nov. 2016 | 990 × 765 (264 KB) | Swpb | x | |
23:42, 9. Nov. 2016 | 990 × 765 (263 KB) | Swpb | x | ||
23:29, 9. Nov. 2016 | 990 × 765 (262 KB) | Swpb | x | ||
00:04, 21. Mai 2016 | 990 × 765 (262 KB) | Swpb | Moved years to top to allow easier visual tracing | ||
15:50, 5. Mai 2016 | 990 × 765 (269 KB) | Swpb | rm incorrect year | ||
01:17, 23. Apr. 2016 | 990 × 765 (262 KB) | Swpb | Fix overlapping state labels | ||
01:09, 23. Apr. 2016 | 990 × 765 (262 KB) | Swpb | Update | ||
00:00, 4. Sep. 2015 | 990 × 765 (258 KB) | Swpb | Fix margin | ||
23:58, 3. Sep. 2015 | 990 × 765 (258 KB) | Swpb | Update 09/2015 | ||
21:20, 2. Jan. 2015 | 990 × 765 (302 KB) | Swpb | Jan 2015 update |
Dateiverwendung
Keine Seiten verwenden diese Datei.
Globale Dateiverwendung
Die nachfolgenden anderen Wikis verwenden diese Datei:
- Verwendung auf en.wikipedia.org
Metadaten
Diese Datei enthält weitere Informationen (beispielsweise Exif-Metadaten), die in der Regel von der Digitalkamera oder dem verwendeten Scanner stammen. Durch nachträgliche Bearbeitung der Originaldatei können einige Details verändert worden sein.
Breite | 990 |
---|---|
Höhe | 765 |