Changeset 3db96b0 in sasmodels


Ignore:
Timestamp:
Feb 23, 2018 9:46:44 AM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
58a1be9
Parents:
aa90015
Message:

improve plotting for 2d monte carlo calculator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • explore/realspace.py

    r032646d r3db96b0  
    423423 
    424424# -------------- plotters ---------------- 
    425 def plot_calc(r, Pr, q, Iq, theory=None): 
     425def plot_calc(r, Pr, q, Iq, theory=None, title=None): 
    426426    import matplotlib.pyplot as plt 
    427427    plt.subplot(211) 
     
    429429    plt.xlabel('r (A)') 
    430430    plt.ylabel('Pr (1/A^2)') 
     431    if title is not None: 
     432        plt.title(title) 
    431433    plt.subplot(212) 
    432434    plt.loglog(q, Iq, '-', label='from Pr') 
     
    437439        plt.legend() 
    438440 
    439 def plot_calc_2d(qx, qy, Iqxy, theory=None): 
     441def plot_calc_2d(qx, qy, Iqxy, theory=None, title=None): 
    440442    import matplotlib.pyplot as plt 
    441443    qx, qy = bin_edges(qx), bin_edges(qy) 
     
    443445    if theory is not None: 
    444446        plt.subplot(121) 
    445     plt.pcolormesh(qx, qy, np.log10(Iqxy)) 
     447    #plt.pcolor(qx, qy, np.log10(Iqxy)) 
     448    extent = [qx[0], qx[-1], qy[0], qy[-1]] 
     449    plt.imshow(np.log10(Iqxy), extent=extent, interpolation="nearest", 
     450               origin='lower') 
    446451    plt.xlabel('qx (1/A)') 
    447452    plt.ylabel('qy (1/A)') 
     453    plt.axis('equal') 
     454    plt.axis(extent) 
     455    #plt.grid(True) 
     456    if title is not None: 
     457        plt.title(title) 
    448458    if theory is not None: 
    449459        plt.subplot(122) 
    450         plt.pcolormesh(qx, qy, np.log10(theory)) 
     460        plt.imshow(np.log10(theory), extent=extent, interpolation="nearest", 
     461                   origin='lower') 
     462        plt.axis('equal') 
     463        plt.axis(extent) 
    451464        plt.xlabel('qx (1/A)') 
    452465 
     
    663676    if show_points: 
    664677         plot_points(rho, points); pylab.figure() 
    665     plot_calc(r, Pr, q, Iq, theory=theory) 
     678    plot_calc(r, Pr, q, Iq, theory=theory, title=title) 
    666679    pylab.gcf().canvas.set_window_title(title) 
    667680    pylab.show() 
     
    688701    if show_points: 
    689702        plot_points(rho, points); pylab.figure() 
    690     plot_calc_2d(qx, qy, Iqxy, theory=theory) 
     703    plot_calc_2d(qx, qy, Iqxy, theory=theory, title=title) 
    691704    pylab.gcf().canvas.set_window_title(title) 
    692705    pylab.show() 
Note: See TracChangeset for help on using the changeset viewer.