<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.sternwarte.uni-erlangen.de/wiki/index.php?action=history&amp;feed=atom&amp;title=GX304batlcobs_%28xfig_example%29</id>
	<title>GX304batlcobs (xfig example) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.sternwarte.uni-erlangen.de/wiki/index.php?action=history&amp;feed=atom&amp;title=GX304batlcobs_%28xfig_example%29"/>
	<link rel="alternate" type="text/html" href="https://www.sternwarte.uni-erlangen.de/wiki/index.php?title=GX304batlcobs_(xfig_example)&amp;action=history"/>
	<updated>2026-05-18T18:19:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.7</generator>
	<entry>
		<id>https://www.sternwarte.uni-erlangen.de/wiki/index.php?title=GX304batlcobs_(xfig_example)&amp;diff=1425&amp;oldid=prev</id>
		<title>Niu: Created page with &quot;=== Insets as zoom-ins  ===  center  &lt;pre&gt; require(&quot;isisscripts&quot;);  %%% all necessary data  % get ObsIDs, tstart, and tstop of all used data from so...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.sternwarte.uni-erlangen.de/wiki/index.php?title=GX304batlcobs_(xfig_example)&amp;diff=1425&amp;oldid=prev"/>
		<updated>2018-05-02T11:38:39Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Insets as zoom-ins  ===  &lt;a href=&quot;/wiki/index.php/File:Gx304batlcobs.png&quot; title=&quot;File:Gx304batlcobs.png&quot;&gt;center&lt;/a&gt;  &amp;lt;pre&amp;gt; require(&amp;quot;isisscripts&amp;quot;);  %%% all necessary data  % get ObsIDs, tstart, and tstop of all used data from so...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Insets as zoom-ins  ===&lt;br /&gt;
&lt;br /&gt;
[[File:gx304batlcobs.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require(&amp;quot;isisscripts&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
%%% all necessary data&lt;br /&gt;
&lt;br /&gt;
% get ObsIDs, tstart, and tstop of all used data from somewhere&lt;br /&gt;
variable data = struct {&lt;br /&gt;
  obsid = [...],&lt;br /&gt;
  tstart = [...],&lt;br /&gt;
  tstop = [...]&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
% load BAT-lightcurve&lt;br /&gt;
variable bat = fits_read_table(&amp;quot;source.lc.fits&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
%%% initialize xfig plot&lt;br /&gt;
&lt;br /&gt;
variable W = 28, H = 10; % width and height of the full-lc plot&lt;br /&gt;
variable wt0 = 54850, wt1 = 56800; % xrange in MJD of this plot&lt;br /&gt;
variable Wi = 5.2, Hi = 3.5; % width and height of the zoom plots&lt;br /&gt;
variable pl = xfig_plot_new(W,H);&lt;br /&gt;
% set world; the negative, small pad-values removes the tic-labels&lt;br /&gt;
% at the end of each axis (my personal liking)&lt;br /&gt;
pl.world(wt0, wt1, 0, 0.8; padx = -1e-6, pady = -1e-6);&lt;br /&gt;
% set 2nd world, here the years&lt;br /&gt;
pl.world2(yearOfMJD(pl.get_world()[0]), yearOfMJD(pl.get_world()[1]),&lt;br /&gt;
	  __push_array(pl.get_world()[[2,3]]); padx = -1e-6, pady = -1e-6);&lt;br /&gt;
pl.x2axis(; major = [2009:2014]+.5-1e-6, minor = [2009:2015],&lt;br /&gt;
            major_len = 0, minor_len = .2, format= &amp;quot; %.0f&amp;quot;);	    &lt;br /&gt;
pl.y2axis(; ticlabels = 0);&lt;br /&gt;
pl.y1axis(; format = &amp;quot;%.2f&amp;quot;);&lt;br /&gt;
pl.xlabel(&amp;quot;Time (MJD)&amp;quot;);&lt;br /&gt;
pl.ylabel(&amp;quot;BAT-cts\,s$^{-1}$\,cm$^{-2}$&amp;quot;R);&lt;br /&gt;
&lt;br /&gt;
%%% plot lightcurve&lt;br /&gt;
&lt;br /&gt;
pl.plot(bat.time, bat.rate, bat.error; color = &amp;quot;red&amp;quot;, sym = &amp;quot;x&amp;quot;,&lt;br /&gt;
        width = 1, size = .5);&lt;br /&gt;
&lt;br /&gt;
%%% create zoom plots&lt;br /&gt;
&lt;br /&gt;
variable pli = Struct_Type[4]; % an array of structures; for each plot one element&lt;br /&gt;
variable t0 = [55260, 55395, 55520, 55655]; % the start (in MJD) for each plot&lt;br /&gt;
variable dt = 60; % the length (in days) for every plot (such that the scaling is equal for all)&lt;br /&gt;
variable ymx = [0.05, 0.42, 0.27, 0.28]; % the maximum y-value for each plot (in cts/s/cm^2)&lt;br /&gt;
variable dx = .24; % the relative spacing between each plot (measured from their centers)&lt;br /&gt;
&lt;br /&gt;
% loop over all plots and create them&lt;br /&gt;
variable i;&lt;br /&gt;
_for i (0, length(pli)-1, 1) {&lt;br /&gt;
  %%% initialize the zoom plots&lt;br /&gt;
  pli[i] = xfig_plot_new(Wi, Hi);&lt;br /&gt;
  pli[i].world(t0[i], t0[i]+dt, 0, ymx[i]*1.1; pady = -1e-6);&lt;br /&gt;
  pli[i].xaxis(; major = t0[i]+[.25,.75]*dt, minor = t0[i]+[0:dt:10],&lt;br /&gt;
                 ticlabel_size = &amp;quot;footnotesize&amp;quot;);&lt;br /&gt;
  pli[i].y1axis(; ticlabel_size = &amp;quot;footnotesize&amp;quot;, format = &amp;quot;%.2f&amp;quot;);&lt;br /&gt;
  pli[i].x2axis(; ticlabels = 0);&lt;br /&gt;
  &lt;br /&gt;
  %%% plot the lightcurve&lt;br /&gt;
  pli[i].plot(bat.time, bat.rate, bat.error; color = &amp;quot;red&amp;quot;, sym = &amp;quot;x&amp;quot;,&lt;br /&gt;
              width = 1, size = .5);&lt;br /&gt;
  % add the observation times&lt;br /&gt;
  pli[i].plot(.5*(data.tstart+data.tstop), ones(length(data.tstart))*ymx[i];&lt;br /&gt;
              sym = &amp;quot;darr&amp;quot;, color = &amp;quot;blue&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
  %%% add the object to the full lightcurve plot&lt;br /&gt;
  variable ix = .5*(1.-dx*length(pli)) + dx*(i+.5); % relative x-coordinate of the zoom plot&lt;br /&gt;
  pl.add_object(pli[i], ix, .55, 0, -.5; world0);&lt;br /&gt;
&lt;br /&gt;
  %%% calculate the xy-positions for the lines connecting&lt;br /&gt;
  %%% the zoom plots with the full lightcurve&lt;br /&gt;
  &lt;br /&gt;
  % relative x/y-coordinates of the lower-[left,right]-corner of the zoom plot&lt;br /&gt;
  variable xi = (pli[i].plot_data.X.x + [0, Wi]) / W;&lt;br /&gt;
  variable yi = pli[i].plot_data.X[0].y / H * [1,1];&lt;br /&gt;
  % relative x/y-coordinates of the [beginning,end] of the zoom time range _in_ the full lightcurve plot&lt;br /&gt;
  variable xl = 1.*(t0[i]+[0,dt]-wt0) / (wt1-wt0);&lt;br /&gt;
  variable yl = (max(bat.rate[where(t0[i] &amp;lt; bat.time &amp;lt; t0[i]+dt)]) + [0.02, 0.04]) / .8;&lt;br /&gt;
&lt;br /&gt;
  %%% plot the connecting lines&lt;br /&gt;
  pl.plot([xl[0], xl[0], xi[0]], [yl, yi[0]]; world0, color = &amp;quot;gray&amp;quot;);&lt;br /&gt;
  pl.plot([xl[1], xl[1], xi[1]], [yl, yi[1]]; world0, color = &amp;quot;gray&amp;quot;);&lt;br /&gt;
  % shade the area in between&lt;br /&gt;
  pl.shade_region(&lt;br /&gt;
    [xl[0], xl[0], xi[0], xi[1], xl[1], xl[1], xl[1]],&lt;br /&gt;
    [yl[0], yl[1], yi[0], yi[1], yl[1], yl[0], yl[0]];&lt;br /&gt;
    color = &amp;quot;#DDDDDD&amp;quot;, world0&lt;br /&gt;
  );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
% render&lt;br /&gt;
pl.render(&amp;quot;BAT_lc.pdf&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:SLxfig]]&lt;/div&gt;</summary>
		<author><name>Niu</name></author>
	</entry>
</feed>