<commit_before>r"""Convenience routines for easily plotting with VisClaw."""

import os
import sys
import types

def plot(setplot_path=None,outdir="./_output",plotdir=None,htmlplot=False,iplot=False,
         file_format='ascii',**plot_kargs):
    r""""""
    
    # Construct a plot directory if not provided
    if plotdir is None:
        try: 
            plotdir = os.path.join(os.path.split(outdir)[:-2],"_plots")
        except AttributeError:
            plotdir = os.path.join(os.getcwd(),"_plots")
    
    if htmlplot or iplot:
        # Grab and import the setplot function
        # Use local setplot if available
        if setplot_path is None:
            local_setplot_path = os.path.join(os.getcwd(),'setplot.py')
            if os.path.exists(local_setplot_path):
                setplot_path = local_setplot_path

        # If setplot_path is still None then we import the default setplot
        if setplot_path is None:
            import visclaw.setplot_default as setplot_module
        else:
            path = os.path.abspath(os.path.expandvars(os.path.expanduser(setplot_path)))
            setplot_module_dir = os.path.dirname(path)
            setplot_module_name = os.path.splitext(os.path.basename(setplot_path))[0]
            sys.path.insert(0,setplot_module_dir)
            setplot_module = __import__(setplot_module_name)
        reload(setplot_module)
        setplot = lambda plotdata:setplot_module.setplot(plotdata,**plot_kargs)<commit_msg>Change default plot behavior to interactive<commit_after>r"""Convenience routines for easily plotting with VisClaw."""

import os
import sys
import types

def plot(setplot_path=None,outdir="./_output",plotdir=None,htmlplot=False,iplot=True,
         file_format='ascii',**plot_kargs):
    r""""""
    
    # Construct a plot directory if not provided
    if plotdir is None:
        try: 
            plotdir = os.path.join(os.path.split(outdir)[:-2],"_plots")
        except AttributeError:
            plotdir = os.path.join(os.getcwd(),"_plots")
    
    if htmlplot or iplot:
        # Grab and import the setplot function
        # Use local setplot if available
        if setplot_path is None:
            local_setplot_path = os.path.join(os.getcwd(),'setplot.py')
            if os.path.exists(local_setplot_path):
                setplot_path = local_setplot_path

        # If setplot_path is still None then we import the default setplot
        if setplot_path is None:
            import visclaw.setplot_default as setplot_module
        else:
            path = os.path.abspath(os.path.expandvars(os.path.expanduser(setplot_path)))
            setplot_module_dir = os.path.dirname(path)
            setplot_module_name = os.path.splitext(os.path.basename(setplot_path))[0]
            sys.path.insert(0,setplot_module_dir)
            setplot_module = __import__(setplot_module_name)
        reload(setplot_module)
        setplot = lambda plotdata:setplot_module.setplot(plotdata,**plot_kargs)
{'fraction_non_alphanumeric': 0.09568417530946804, 'fraction_numerical': 0.0020073603211776514, 'mean_word_length': 2.775252525252525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2713154', 'n_tokens_mistral': 940, 'n_tokens_neox': 914, 'n_words': 190}