Mercurial > forge
changeset 6606:981058e1fbd8 octave-forge
Initial import of gnuplot wrappers
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/COPYING Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/COPYRIGHT Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,15 @@ +## Copyright (C) 2010 Tyzx, Inc <etienne@tyzx.com> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, see +## http://www.gnu.org/licenses/gpl-3.0.html .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/DESCRIPTION Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,15 @@ +Name: Gnuplot +Version: 1.0.0 +Date: 2010-01-17 +Author: Etienne Grossmann +Maintainer: Etienne Grossmann +Title: Gnuplot wrappers for octave +Description: Scripts to save data in gnuplot-readable formats, +specify gnuplot commands that will be used to produce graphics, and +call gnuplot. See help g_ez quickly produce the most common plots. +Categories: graphics +Depends: octave (>= 3.0.0) +SystemRequirements: gnuplot (>= 4.0) +BuildRequires: gnuplot (>= 4.0) +License: GPL version 2 or later +Url: http://octave.sf.net
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/COPYRIGHT Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,1 @@ +Copyright (c) 2007, Tyzx Corporation. All rights reserved.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/Changelog Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,8 @@ + +2008/05: Possibility of plotting a label with each data point in g_ez, either w/ + e.g. g_ez ("plot", rand(5,2), {"Label 1","Label 2", "3", "X", "Y"}) or w/ + g_ez ("plot", rand(10,2), "#") or + g_ez (plot", rand(10,2), "-o#4;Random Points;") + + g = g_plot (g) saves the locations of double-clicks and middle button + clicks in g.double_clicks and g.middle_clicks. \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/LICENSE.txt Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_check.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,18 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function isok = _g_check (g) +### isok = _g_check (g) - Check that g is a gnuplot_object +### +### If nargout == 0, an error is raised if g is not a gnuplot_object. +### Else, isok is set to 0 and returned. + isok = 1; + if !isstruct (g) + isok = 0; + if !nargout, error ("1st argument is not a struct"); endif + if !strcmp (g.type, "gnuplot_object") + isok = 0; + if !nargout, error ("1st argument is not a gnuplot_object"); endif + endif + endif + if !nargout, clear isok; endif +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_default_tics.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,18 @@ +## ticpos = _g_default_tics (minmax, ntics = 5) - Set tics in interval for plotting +## +## Tics to place in interval minmax, approximately ntics of them (default 5), +## while ensuring the spacing between tics is 1eL, 2eL or 5eL, for some integer +## L. +function t = _g_default_tics (rng, ntics) + +if nargin < 2, ntics = 5; endif + +step = diff(rng)/ntics; +if !step, step = 1; endif +lstep = 10 ^ floor (log10 (step)); + +## Pick tic w/ leading 1,2 or 5 +step = lstep * [1 2 2 5 5 5 5 10 10 10](round (step/lstep)); + + +t = step*[ceil(rng(1)/step):floor(rng(2)/step)];
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_image_cmd.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,115 @@ +## [fmt, extra, i, zrange] = _g_image_cmd (sz, zrange, args, va) +## +## sz = [H W] or [H W 3] image size +## zrange = [min, max] range of greylevel/RGB values +## args struct w/ current defaults +## va extra options +## "range" , r: replace zrange +## "xrange", r: Define region in which image is drawn +## "yrange", r: +## "xyrange", r: +## "colormap" yesno : map greylevels to color +## +## fmt : Gnuplot plot argument +## extra : Gnuplot pre-plot argument +## i : Number of arguments used in va. +function [fmt, extra, i, zrange] = _g_image_cmd (sz, zrange, args, va) + +if ! struct_contains (args, "xrange") + args.xrange = [0,sz(2)]; +end + +if ! struct_contains (args, "yrange") + args.yrange = [0,sz(1)]; +end + +grange = []; # Given range + +colormap = 0; + +flipx = -1; +flipy = -1; +is_col = -1; + +i = 1; +done = 0; + +while i <= length (va) && !done + tmp = va{i}; + if ! ischar (tmp), break; end + switch tmp + case "flipx", flipx = va{++i}; + case "flipy", flipy = va{++i}; + case "range", grange = zrange = va{++i}; + case "is_col", is_col = va{++i}; + case "xrange", args.xrange = va{++i}; + case "yrange", args.yrange = va{++i}; + case "xyrange", args.yrange = args.xrange = va{++i}; + case "colormap", colormap = va{++i}; + otherwise break; + end + i++; +endwhile +i--; + +if is_col == -1 + is_col = length (sz) == 3; +end +title_str = ""; + +xr = args.xrange; +yr = args.yrange; + +s1 = sprintf (" binary array=%ix%i ", sz([2 1])); +if flipx >= 0 + if flipx + s1 = [s1,"flipx "]; + end +end +if xr(2) < xr(1) + xr = xr([2 1]); + if flipx < 0, s1 = [s1,"flipx "]; end +end + +if flipy >= 0 + if ! flipy + s1 = [s1,"flipy "]; + end +end +if yr(2) > yr(1) + if flipy < 0, s1 = [s1,"flipy "]; end +else + yr = yr([2 1]); +end + +s2 = sprintf (" origin=(%g,%g) ",\ + xr(1) + 0.5*diff(xr)/sz(2), \ + yr(1) + 0.5*diff(yr)/sz(1)); +s3 = sprintf (" dx=%g dy=%g ",\ + (xr(2)-xr(1))/sz(2),\ + (yr(2)-yr(1))/sz(1)); + +s4 = " format='%uchar' "; + +if !is_col + s5 = sprintf (" using (%g*$1/255+%g) ",\ + diff(zrange), zrange(1)); + s6 = [" with image "]; + +else + s5 = sprintf (" using (%g*$1/255+%g):(%g*$2/255+%g):(%g*$3/255+%g) ",\ + [diff(zrange);zrange(1)]*[1 1 1]); + s6 = [" with rgbimage "]; +end +s7 = sprintf (" title '%s' ", title_str); + + +fmt = [s1 s2 s3 s4 s5 s6 s7]; + +extra = {}; +if !colormap, + extra = {extra{:}, "set palette gray"}; +end +if !isempty (grange) + extra = {extra{:}, sprintf("set cbrange [%g:%g]",grange)}; +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_instantiate.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,62 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. +function g = _g_instantiate (g, varargin) +### g = _g_instantiate (g,"VAR", Value, ...) - Substitute all values in g.cmds. +### +### For each occurence of "<VAR>" in g.cmds{:}, a value is seeked either on the +### command line (preferentially) or in g.values.(VAR). +### +### If no value is found, an error occurs. Otherwise, the value is used to +### substitute "<VAR>". Non-string values are converted to strings by sprintf +### ("%g",value). +### +### See also: g_new, g_set. + + ##printf ("Instantiating g at '%s'\n",g.dir); + + cmd_str = sprintf ("%s\n",g.cmds{:}); + # Substitute variables ############### + [dums,dume,dumte,dumm,toks] = regexp (cmd_str, '<(\w+)>'); + + # Determine used tokens + kword_cnt = struct(); + for i = 1:length (toks), kword_cnt.(toks{i}{1}) = 1; end + + # Get all values + if struct_contains (g, "values"), + if !isstruct (g.values) + error ("g.values should be a struct. Got a %s",typeinfo (g.values)); + endif + vals = g.values; + else + vals = struct(); + endif + if length (varargin), vals = setfield (vals, varargin{:}); endif + + # Substitution + for [dumv, kword] = kword_cnt + + if struct_contains (vals, kword) + + value = vals.(kword); + if !ischar (value), value = sprintf ("%g",value); endif + cmd_str = strrep (cmd_str, ["<",kword,">"], value); + else + error ("No value specified for variable '%s'",kword); + endif + endfor + # Put back in cmds + # note: there's a "\n" at end of cmd_str. + end_of_lines = [0, find(cmd_str == "\n")]; + + if length (g.cmds) != length (end_of_lines) - 1 + g.cmds + end_of_lines + keyboard + error ("g.cmds has %i elements, but cmd_str has %i lines",\ + length (g.cmds), length (end_of_lines) - 1); + endif + for i = 1:length(end_of_lines)-1 + g.cmds{i} = cmd_str(end_of_lines(i)+1:end_of_lines(i+1)-1); + endfor + +endfunction # EOF _g_instantiate
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_istoken.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,30 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function c = _g_istoken (str, token) +### Check that first chararcters of str match that of token and that the first +### non-matching char is ":" + + if isempty (str), c = 0; return; endif + if isempty (token), c = str(1)==":" ; return; endif + + c = 1; + while 1 + if str(c) != token(c) + if c > 1 && str(c) == ":", return; end + c = 0; + return; + endif + c++; + if c > length(str) + c--; + if str(c) == ":"; return; endif + c = 0; return; + endif + if c > length(token) + c--; + if token(c) == ":"; return; endif + c = 0; + return; + endif + endwhile +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_map.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,32 @@ +## y = _g_map (the_map, x) +function y = _g_map (the_map, x) + +if isempty (the_map) + + y = x; + +elseif ischar (the_map) + + if isvarname (the_map) # Assume a function name + + y = feval (the_map, x); + + else # Assume an expression like "x.*sin(x)" + + y = eval (the_map); + end + +elseif ismatrix (the_map) && rows (the_map) == 2 + + N = columns (the_map); + y = interp1 (the_map(1,:), the_map(2,:), "linear", "extrap"); + y(x < the_map(1,1)) = the_map(2,1); + y(x > the_map(1,N)) = the_map(2,N); + +else + printf ("Don't know what to do w/ map of type %s", typeinfo (the_map)) + whos the_map + keyboard +end + + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_parse_oct_fmt.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,140 @@ +### Copyright (c) 2007-, Tyzx Corporation. All rights reserved. + +### [isFmt, fmtContents, labelFmt] = _g_parse_oct_fmt (FMT, plotn, wantLabel) +### +### Take a string FMT, e.g. "-5;Foobar;", in octave's plot (x,y,FMT) format and +### tries to translate it into fmtContents, a gnuplot string like +### +### "with lines linetype 5 title 'Foobar'". +## +### isFmt is 1 if FMT makes sense in octave's plot syntax, 0 otherwise. +### +### If the wantLabel is true, or if the "format" part of FMT ("-5", in the +### example above) contains a "#", then labelFmt will hold a gnuplot string that +### plots a label with each data point. +function [isFmt, fmtContents, labelFmt] = _g_parse_oct_fmt (str,plotn, wantLabel) + + if nargin<2, plotn = 0; endif + if nargin<3, wantLabel = 1; endif + + isFmt = 0; + defaultTitle = ""; + if plotn, defaultTitle = sprintf ("Line %i",plotn); endif + + fmtContents = sprintf ("with lines lt %i title '%s'", plotn, defaultTitle); + + labelFmt = ""; + if (iscell (wantLabel) && !isempty (wantLabel)) || (!iscell (wantLabel) && wantLabel) + wantLabel = 1; + labelFmt = sprintf ("with labels tc lt %i offset 0,1 notitle ", plotn); + end + + if !ischar(str) + return; + endif + + ## Matches style, color, key + ##re = "^(\\.|@|-[@+*x]?|[L\\+\\*ox\\^]|)([1-6][1-6]?|[krgbmcw]|)(;[^;]*;|)$"; + re10 = "^(\\.|@|-[@\\+\\*xo]?|[L\\+\\*ox\\^]|)([#1-6krgbmcw][1-6]?|)"; + re11 = "^(with[^;]*)"; + re2 = "(;[^;]*;)$"; + ## re seems to fail on ';aaa;' + ##[S, E, TE, M, T, NM] = regexp (str, re) + + style = "with lines lw 5 "; + color = ""; + title = "title ''"; + ##pointstyle = ""; Unused + + T = regexp (str, re11, "tokens"); # Try gnuplot-like style + if ! isempty (T) + ## workaround for regexp's bug + if ! isempty (T) && length (T{1}) == 1 + T{1} = {"",T{1}{:}}; + end + style = T{1}{2}; + color = ""; + title = ""; + else + T = regexp (str, re10, "tokens"); + + if !isempty (T) + ## workaround for regexp's bug + if ! isempty (T) && length (T{1}) == 1 + T{1} = {"",T{1}{:}}; + end + + xt = " lw 3 "; + # TODO: more correct way of dealing w/ T{1}{1} + style0 = "lines"; + ##T{1}{1} + if length (T{1}{1}) # Style + switch T{1}{1} + case "-+", style0 = "linespoints"; xt = " pointtype 1 "; + case "-*", style0 = "linespoints"; xt = " pointtype 3 "; + case "-o", style0 = "linespoints"; xt = " pointtype 6 "; + case "-@", style0 = "linespoints"; xt = " pointtype 6 "; + case "^", style0 = "impulses"; xt = ""; + case "@", style0 = "points"; xt = " pointtype 6 "; + case "*", style0 = "points"; xt = " pointtype 3 "; + case "+", style0 = "points"; xt = " pointtype 1 "; + case "x", style0 = "points"; xt = " pointtype 2 "; + case "o", style0 = "points"; xt = " pointtype 6 "; + case "-", style0 = "lines"; xt = ""; + case "L", style0 = "steps"; xt = ""; + case ".", style0 = "dots"; xt = ""; + otherwise style0 = "lines"; xt = " lw 3 "; + endswitch + endif + style = ["with ",style0, xt]; + + if length (T{1}{2}) # Label wanted? + if index (T{1}{2}, "#") + wantLabel = 1; + T{1}{2} = T{1}{2}(T{1}{2} != "#"); + end # Now, there is no "#" in T{1}{2}, so T{1}{2} + # should be color and/or point + end # + if length (T{1}{2}) # Color (and maybe pointstyle) + # First character is color, as number or letter + + if index ("123456789", T{1}{2}(1)) + color = T{1}{2}(1); + else # Convert letter to digit + color = struct(qw("k 6 r 1 g 2 b 3 m 4 c 5 w 7"){:}).(T{1}{2}(1)); + endif + if length (T{1}{2}) > 1 && index ("123456789", T{1}{2}(2)) + ## pointstyle = ["pt ",T{1}{2}(2)]; + endif + if strcmp (style0, "lines") + color = ["ls ",color]; + else + color = ["lt ",color]; + end + endif + end # EOF !isempty (T): Matlab-like style spec + endif + T = regexp (str, re2, "tokens"); + + if !isempty (T) + if length (T{1}{1}) # title (aka key, label) + title = ["title '",T{1}{1}(2:end-1),"'"]; + endif + endif + ##fmtContents = [style," ",color," ",title," lw 3 "]; + fmtContents = [style," ",color," ",title]; + isFmt = 1; + + if iscell (wantLabel) + wantLabel = ! isempty (wantLabel); + end + if wantLabel + labelColor = ""; + if length (color) + labelColor = [" tc ", color]; + end + + labelFmt = ["with labels ",labelColor," offset 0,1 notitle "]; + end + +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_parse_oct_fmt.m.merge Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,63 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function [isFmt, fmtContents] = _g_parse_oct_fmt (str,plotn) +## [isFmt, fmtContents] = _g_parse_oct_fmt (str,plotn) +## Take a string FMT, e.g. "-5;Foobar;", in octave's plot (x,y,FMT) format and +## tries to translate it into fmtContents, a gnuplot string like "with lines +## linetype 5 title 'Foobar'". +## +## isFmt is 1 if FMT makes sense in octave's plot syntax, 0 otherwise. + + if nargin<2, plotn = 0; endif + + isFmt = 0; + defaultTitle = ""; + if plotn, defaultTitle = sprintf ("Line %i",plotn); endif + fmtContents = ["with lines title '",defaultTitle,"'"]; + if !ischar(str), return; endif + + ## Matches style, color, key + re = "^(\\.|@|-[@+*x]?|[L\\+\\*ox\\^]|)([1-6][1-6]?|[krgbmcw]|)(;[^;]*;|)$"; + [S, E, TE, M, T, NM] = regexp (str, re); + + style = "lines"; + color = ""; + title = "title ''"; + pointstyle = ""; + if !isempty (S) + if length (T{1}{1}) # Style + switch T{1}{1} + case "-+", style = "linespoints"; + case "-@", style = "linespoints"; + case "^", style = "impulses"; + case "@", style = "points"; + case "*", style = "points"; + case "+", style = "points"; + case "-", style = "lines"; + case "L", style = "steps"; + case ".", style = "dots"; + endswitch + endif + style = ["with ",style]; +#if defined( FILE2 ) + endif +#endif + if length (T{1}{2}) # Color (and maybe pointstyle) + if index ("123456", T{1}{2}(1)) + color = T{1}{2}(1); + if length (T{1}{2}) > 1 + pointstyle = ["pt ",T{1}{2}(2)]; + endif + else # Convert letter to digit + color = struct(qw("k 6 r 1 g 2 b 3 m 4 c 5 w 7"){:}).(T{1}{2}); + endif + color = ["lt ",color]; + endif + if length (T{1}{3}) # title (aka key, label) + title = ["title '",T{1}{3}(2:end-1),"'"]; + endif + endif + ##fmtContents = [style," ",color," ",title," lw 3 "]; + fmtContents = [style," ",color," ",title]; + isFmt = 1; +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_save_data.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,64 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function _g_save_data (filename, data, stops, labels) + + [R,C] = size (data); + if nargin<3, stops = R; endif + if nargin<4, labels = 0; endif + if isempty(stops), stops = R; endif + if stops(1)!=0, stops = [0, stops(:)']; endif + if stops(end) != R, stops = [stops(:)', R]; endif + + ## ndecimals = max (1, \ + ## ceil ( abs(log10 (max (abs (data(:))))) \ + ## + 4*abs(log10 (min (std (data)))) \ + ## )); + ndecimals = 18; + tpl = ["%.",sprintf("%ig ",ndecimals)]; + tpl = char (kron (ones(1,C),toascii (tpl))); + if !iscell (labels) && labels, + tpl = [tpl, " %i"]; + data = [data, (1:R)']; + C++; + end + tpl0 = tpl; + tpl = [tpl, "\n"]; + + no_text_labels = ! iscell (labels) || isempty (labels); + + if ! no_text_labels + for j = 1:length(labels) + if isnumeric (labels{j}) + if abs (labels{j} - round (labels{j})) < eps + labels{j} = sprintf ("%i", labels{j}); + else + labels{j} = sprintf ("%g", labels{j}); + end + end + endfor + endif + + [fid, msg] = fopen (filename,"w"); + if fid<0, + error ("Can't open data file '%s': %s", filename, msg); + endif + + for i = 2:length(stops) + if no_text_labels + fprintf (fid, tpl, data(stops(i-1)+1:stops(i),:)'); + else + for j = stops(i-1)+1:stops(i) + fprintf (fid, tpl0, data(j,:)'); + fprintf (fid, " "); + j_label = 1 + rem (j-1, length (labels)); + fprintf (fid, ['"', labels{j_label}, '"']); + fprintf (fid, "\n"); + endfor + end + fprintf (fid, "\n"); + endfor + + if fclose (fid) + error ("Can't close data file '%s': %s", filename); + endif +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_stringify.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,30 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. +function val_str = _g_stringify (name, value) + + ## Use double quotes rather than simple quote, so that newlines are recognized + ## as such + if ischar (value), + if index (name, "range") + val_str = value; + else + val_str = ["\"",value,"\""]; + endif + return; + end + switch name + case {"xrange", "yrange", "x2range", "y2range", "range"} + if prod (size (value)) != 2 + error ("Argument to %s should have size 2",name); + endif + val_str = sprintf ("[%g:%g]", value); + val_str = strrep (val_str, "NaN","*"); + val_str = strrep (val_str, "Inf","*"); + case "geometry" + if prod (size (value)) != 2 + error ("Argument to %s should have size 2",name); + endif + val_str = sprintf ("%ix%i", value); + otherwise + error ("Unknown argument to stringify '%s'", name); + endswitch +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/_g_tics.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,67 @@ +## gnuplot_tic_setting_command = _g_tics (values, labels, ...) +## options: +## "x", "y", "z", "x2", "y2", "cb" axis on which tics go +## "tpl" default 'tpl = "set %stics (%s)";' +## "fmt" default '%3.2f' +## "major" default 1:length (values) +function s = _g_tics (values, labels, varargin) + +N = length (values); + +side = "x"; +tpl = "set %stics (%s)"; +fmt = "% g"; + +major = 1:N; + +if nargin < 2, labels = values; end +assert (length (labels) == N); + +n = 2; +while n<nargin + n++; + opt = varargin{n-2}; + assert (ischar (opt)) + if opt(1) == "%", fmt = opt; continue; end + switch opt + case "x", side = "x"; + case "y", side = "y"; + case "z", side = "z"; + case "x2", side = "x2"; + case "y2", side = "y2"; + case "cb", side = "cb"; + case "tpl", tpl = varargin{++n-2}; + case "fmt", fmt = varargin{++n-2}; + case "major", major = varargin{++n-2}; + otherwise, + error ("Unknown option '%s'",opt); + end +end + +if ! (length (major) == N && all (major == 0 | major == 1) \ + || all (major >= 1 & major <= N & major == round (major))) + major + values + "Problem w/ major tic argument. Please fix" + keyboard +end +if length (major) == N && all (major == 0 | major == 1) + #tmp = zeros(1,N); + #tmp(major) = 1; + #major = tmp; + major = find (major); +end + +s1 = sprintf (["\"",fmt,"\" %f, "],[labels(major)(:) values(major)(:)]')(1:end-2); + + + +minor = setdiff (1:N, major); +if ! isempty (minor) + s2 = ""; + s2 = sprintf ("\"\" %f, ",values(minor))(1:end-2); + s1 = [s1, ", ", s2]; +end + + +s = sprintf (tpl, side, s1); \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/boxplot_data.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,47 @@ +## s = boxplot_data (x) +## +## s.quantiles : quantiles [0.05, 0.25, 0.5, 0.75, 0.95] of x +## s.outliers : +function s = boxplot_data (x) + +C = columns (x); +R = rows (x); + +if ! any (isnan (x(:))) + + sx = sort (x); + + ifloor = 1+floor([0.05 0.25 0.50 0.75 0.95]*(R-1)); + iceil = 1+ceil ([0.05 0.25 0.50 0.75 0.95]*(R-1)); + + s.quantiles = (sx(ifloor,:) + sx(iceil,:))/2; + + stdx = nanstd (x); + meanx = nanmean (x); + + s.mean = meanx; + s.std = stdx; + + for i = 1:C + iout = find (abs (x(:,i)-meanx(i)) > 3*stdx(i)); + s.outliers{i} = x(iout,i); + end +else # There are NaNs + + sx = sort (x); + + nok = sum (!isnan (x)); + + ifloor = 1+floor([0.05 0.25 0.50 0.75 0.95]'*(nok-1)); + iceil = 1+ceil ([0.05 0.25 0.50 0.75 0.95]'*(nok-1)); + + s.quantiles = nan (5,C); + for i = 1:C + if nok(i) + s.quantiles(:,i) = (sx(ifloor(:,i),i)+sx(iceil(:,i),i))/2; + end + + iout = find (abs (x(:,i)-meanx(i)) > 3*stdx(i)); + s.outliers{i} = x(iout,i); + end +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/csplice.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,24 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +## c = csplice (c,p,l,c2) - Splice a cell (p starts at 0) +## +## TODO: Make p start at 1, check code that uses csplice +## Author <etienne@tyzx.com> +function c = csplice (c,p,l,c2) + +N = length (c); +if p < 0, p = N + p + 1; end + +if nargin == 3 + c2 = l; + l = N - p + 1; +end +if nargin == 2 + c2 = {}; + l = N - p + 1; +end + +if l < 0, l = N + l; end + +c = {c{1:p},c2{:},c{p+l+1:length(c)}}; +end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_cmd.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,187 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function g = g_cmd (g, varargin) +### g = g_cmd (g, <command or gnuplot_object or option>,...) +### +### Adds plotting commands to g. Each command is either a string that will be +### passed to gnuplot, or a "gnuplot_object" whose commands will be executed +### (in the right directory). gnuplot_objects are instantiated (see +### _g_instantiate) before being insterted in the command list. +### +### OPTIONS: +### "-at", <num> : Insert subsequent sequence of commands (until next "-at" +### option, or end of commands) after position <num>, rather +### than end of g's command list. Use <num> = 0 to insert at +### beginning. +### +### see also: g_new ... + + _g_check (g); + if nargout<1, error ("g_cmd called in void context"); endif + + ## Position at which commands are inserted + insert_pos = length (g.cmds); + + ## Should I force multiplot? (checked at end) + force_multiplot = 0; + + i = 1; + while i <=length(varargin) + # #################################### + if ischar (varargin{i}) # Command is a string + + cmds = varargin{i++}; + + if cmds(1)=="-" # It's an option + switch cmds + case "-at", insert_pos = varargin{i++}; + otherwise error ("Unknown option '%s'",cmds); + endswitch + continue; + endif + + # Command is printf format + labelEnd = _g_istoken (cmds, "printf:"); + if labelEnd + ##if length(cmds)>2 && all (cmds(1:2) == ("printf:")(1:2)) + + ## labelEnd = index (cmds, ":"); + ## if !labelEnd, error ("malformed print directive : '%s'",cmds); endif + + label = cmds(1:labelEnd); + # Search for end of args + + # Check if user provided it + firstPrintArg = i; + lastPrintArg = i; + nPrintArgs = -1; + + if labelEnd < length(cmds) + # !!! \d does not work + [numSta,numEnd] = regexp (cmds(labelEnd+1:end),'^[0-9]+:'); + if !isempty(numSta), + nPrintArgs = str2num (cmds(labelEnd+(numSta:numEnd-1))); + labelEnd += numEnd; + lastPrintArg = firstPrintArg + nPrintArgs - 1; + i = lastPrintArg + 1; + endif + endif + + if nPrintArgs < 0 # Not provided: search for end label + + label = ["/",label]; # End label + while lastPrintArg<=length(varargin) \ + && ( !ischar (varargin{lastPrintArg}) \ + || !strcmp (varargin{lastPrintArg}, label)) + lastPrintArg++; + endwhile + + if lastPrintArg > length(varargin) + warning ("g_cmd_PRINTF_NOT_CLOSED",\ + "Can't find closing label for '%s'",cmds); + i = lastPrintArg; + else + i = lastPrintArg + 1; + lastPrintArg--; + endif + endif + if firstPrintArg <= lastPrintArg + spf_format = cmds(labelEnd+1:end); + + cmds = sprintf (spf_format, varargin{firstPrintArg:lastPrintArg}); + else + cmds = cmds(labelEnd+1:end); + endif + # now, cmds is plain string + endif # EOF process printf arguments + + # #################################### + # Add plain string command + ##g.cmds = {g.cmds{:}, cmds}; + while cmds(end) == "\n" + printf ("g_cmd: removing newline at end of command\n"); + cmds = cmds(1:end-1); + end + if index (cmds, "\n") + printf ("g_cmd: Warning: there's a newline in command\n"); + endif + ##cmds = [cmds,"\n"] + g.cmds = csplice (g.cmds, insert_pos++, 0, {cmds}); + + # #################################### + # Command is a gnuplot_object: + # Instantiate it and insert its commands (making + # sure they are executed in the right directory) + elseif isstruct (varargin{i}) + + if _g_check (varargin{i}) + + g2 = _g_instantiate (varargin{i++}); + + if 1 ## && struct_contains (g2, "local") && g2.local + + g.owns = {g.owns{:}, g2.dir}; + g.owns = {g.owns{:}, g2.owns{:}}; + endif + + # remove multiplot commands from g2.cmds: they + # would erase what was plotted until now + if 1 + i1 = i2 = 1; + for i1 = 1:length(g2.cmds) + if isempty (regexp (g2.cmds{i1}, 'set\s+multiplot')) + g2.cmds{i2++} = g2.cmds{i1}; + endif + endfor + g2.cmds = {g2.cmds{1:i2-1}}; + endif + if 0 + g.cmds = {g.cmds{:}, \ + ["cd '",g2.dir,"'"],\ + g2.cmds{:},\ + ["cd '",g.dir,"'"]}; + endif + if 1 + #printf ("Insert at %i\n",insert_pos); + #g2.cmds + #g.cmds + g.cmds = csplice (g.cmds, insert_pos, 0, \ + {["cd '",g2.dir,"'"], \ + g2.cmds{:}, \ + ["cd '",g.dir,"'"]\ + }); + insert_pos += 2 + length (g2.cmds); + #g.cmds + ##printf ("After insert\n"); + #g + #keyboard + endif + force_multiplot = 1; + else + error ("Command %i is a struct but not a 'gnuplot_object'\n", i); + endif + else + error ("Command %i is neither string nor struct, but a",\ + i, typeinfo (varargin{i})); + endif + endwhile + if force_multiplot # Make sure there's a multiplot command at the + # top + i = 1; + while i <= length (g.cmds) # Check for existing set multiplot + if regexp (g.cmds{i}, 'set\s+multiplot') + break + endif + i++; + endwhile + if i > length (g.cmds) # If there's none, put one at the head. + + multiplot_cmd = "set multiplot"; + if struct_contains (g.values, "title") + multiplot_cmd = [multiplot_cmd," '",g.values.title,"'"]; + endif + g.cmds = {multiplot_cmd,\ + g.cmds{:}}; + endif + endif +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_config.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,71 @@ +### VALUE = g_config (NAME, [, NEW_VALUE]) - Get/set settings of g_XYZ functions +### +### NAME can be one of +### +### "gnuplot_version" : Gnuplot version, e.g. [MAJOR, MINOR, PATCHLEVEL] +### This parameter cannot be set. +### "gnuplot_program" : Gnuplot program that is called in g_plot() +### Default is "gnuplot" +### "eps_viewer" and "png_viewer" : Programs called to view eps or png plots. +### Defaults are "gv" and "eog". + +function res = g_config (varargin) + +persistent g_config_struct = \ + struct ("gnuplot_program", "gnuplot",\ + "png_viewer", "eog",\ + "eps_viewer", "gv",\ + "gnuplot_version", nan); + +if all (numel (varargin) != [1 2]) + help g_config + return +end + +switch varargin{1} + case {"gnuplot_program", "png_viewer", "eps_viewer"} + + varName = varargin{1}; + + # Reset gnuplot_version if needed + if strcmp (varName, "gnuplot_program") && !strcmp (varName, g_config_struct.gnuplot_program) + gnuplot_version = nan; + end + + if numel (varargin) > 1 + g_config_struct.(varName) = varargin{2}; + end + res = g_config_struct.(varName); + case "gnuplot_version" + if numel (varargin) > 1 + error ("gnuplot_version cannot be set"); + end + if isnan (g_config_struct.gnuplot_version) + g_version_cmd = [g_config_struct.gnuplot_program, " --version"]; + [status, output] = system (g_version_cmd); + if status + error ("Can't run '%s'", g_version_cmd) + end + if output(end) == "\n" + output = output (1:end-1); + end + va = toascii (output); + va(va < toascii("0") | va > toascii("9")) = toascii (" "); + try + vn = eval (["[", char(va),"]"]); + catch + error ("Can't get gnuplot version number from output '%s'", output) + end + g_config_struct.gnuplot_version = vn; + if numel (vn) < 2 + error ("Gnuplot version looks strange: '%s'", output); + end + end + res = g_config_struct.gnuplot_version; + otherwise + help g_config + error (["Don't know what to do with ", varargin{1}]) +endswitch + + + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_data.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,145 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function g = g_data (g, varargin) +### g = g_data (g, <options>, <filename>, <matrices>, ... ) +### +### ARGUMENTS: +### <filename>, <mat1>,... : Write <mat1>,... (they should all have same width) +### in a file named <string>. Matrices are separated by an +### empty line (so that gnuplot chops lines up), unless the +### "-join" option is used. +### +### OPTIONS: +### "-step", <num> : Write a blank line every <num> lines in the next +### written file (so that gnuplot chops lines up) +### +### "-stops",[pos1, pos2,...] : Put a blank line after the pos1'th row, pos2'th +### row etc. +### +### "-join", : Do not put an empty line between the various matrices +### of the next file. +## +### "-label", yesno : +### +### "-uint8", : Save data as uint8 (e.g. to plot as image later). +### + + + _g_check (g); + if nargout<1, error ("g_data called in void context"); endif + + i = 1; + step = 0; # Size of blocks; 0 means all + join = 0; + data = []; + stops = 0; + raw_data = 0; + chosen_stops = 0; + label = 0; + + while i <= length(varargin) + name = varargin{i++}; + + if !ischar (name) + error ("Data arg %i is not char, but %s", i-1, typeinfo (name)); + endif + + + if strcmp (name,"-step") # Step option + step = varargin{i++}; + continue; + elseif strcmp (name,"-stops") # Step option + chosen_stops = [0,varargin{i++}(:)']; + continue; + elseif strcmp (name,"-join") # Step option + join = 1; + continue; + elseif strcmp (name,"-uint8") # Step option + raw_data = 1; + continue; + elseif strcmp (name,"-label") # Step option + label = varargin{i++}; + continue; + elseif name(1) == "-" # Bad option + error ("Unknown option '%s'",name); + endif + # It's data + + while i <= length(varargin) && isnumeric (varargin{i}) + + stops = [stops,rows(varargin{i})]; + + if isempty (data) + data = varargin{i}; + else + if columns (varargin{i}) == columns (data) + data = [data;varargin{i}]; + else + error ("Data was %i columns wide until now, but arg %i is %i wide",\ + columns(data), i, columns(varargin{i})); + endif + endif + i++; + ##size(data) + endwhile + stops = cumsum(stops); + # NOPE! Assume that a column is meant when a single + # row was passed. + ##if rows(data)==1, data = data(:); endif + + if !raw_data + + ##save("-ascii", [g.dir,"/",name], "data"); + if join + if step, stops = [0:step:rows(data), rows(data)]; + else stops = [0, rows(data)]; + endif + else + if step, + tmp_stops = zeros(1,0); + for j = 2:length(stops) + tmp_stops = [tmp_stops,stops(j-1):step:stops(j),stops(j)]; + endfor + stops = tmp_stops; + endif # If step == 0, stops are fine as they are + endif + if length (chosen_stops) > 1, stops = chosen_stops; endif + + ibad = find (any (isnan(data') | isinf(data'))); + if length (ibad) + printf ("Getting rid of some NaN or Inf data\n"); + + igood = find (all (!isnan(data') & !isinf(data'))); + data = data(igood,:); + stop0 = zeros (1,1+rows(data)); + + if !isempty (stops), + stop0(stops+1) = 1; + end + stop0(ibad) = 1; + stops = cumsum(!stop0)(find (stop0)); + endif + + stops = create_set (stops); + _g_save_data ([g.dir,"/",name], data, stops,label); + else # Raw data + filename = [g.dir,"/",name]; + [fid, msg] = fopen (filename,"w"); + if fid<0, + error ("Can't open raw data file '%s': %s", filename, msg); + endif + count = fwrite (fid, uint8(data), "uint8"); + if count != prod (size (data)) + error ("Could only write %i out of %i bytes of data.",\ + count, prod (size (data))); + endif + fclose (fid); + endif + # Reset step etc + step = 0; + join = 0; + data = []; + stops = 0; + raw_data = 0; + chosen_stops = 0; + endwhile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_delete.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,46 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function g = g_delete (g) +### g = g_delete (g) - Delete a gnuplot_object and its directory +### g_delete () Delete all gnuplot_object directories +### g_delete ("all") Delete all gnuplot_object directories +### g_delete ("siblings") Delete all gnuplot_object directories created +### by this octave process +### +### TODO: A mechanism to make sure no directories are forgotten (disk +### leaks, as in "memory leaks") and that no dir gets deleted spuriously +### (that side is ok now. Just do g_delete() now and then). +### + if !nargin, g = "all"; endif + + if ischar (g) # Clear all directories I'm allowed to clear + if strcmp (g, "all") + allpidfiles = glob ("/tmp/oct-*/PID-*.txt") + elseif strcmp (g, "sib") || strcmp (g, "siblings") + allpidfiles = glob (sprintf("/tmp/oct-*/PID-%i.txt",getpid())) + else + error ("unknown string argument '%s'",g); + end + for i = 1:length(allpidfiles) + tmp = allpidfiles{i}; + j = rindex (tmp, "/"); + system (["rm -f ",tmp(1:j),"*"]); + system (["rmdir ",tmp(1:j-1)]); + endfor + else + _g_check (g); + + if exist (g.dir, "dir") + system (["rm -f ",g.dir,"/*"]); + system (["rmdir ",g.dir]); + endif + for i = 1:length(g.owns) + if exist (g.owns{i}, "dir") + system (["rm -f ",g.owns{i},"/*"]); + system (["rmdir ",g.owns{i}]); + endif + endfor + g = struct(); + end + if !nargout, clear g; endif +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_demo.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,148 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. +function g_demo () +### g_demo() - Show a few plots created by g_XYZ +### +### See also: g_new, demo g_ez, etc.. + + save_snapshots = 0; + g_demo_plot_cnt = 0; + plot_extras = {}; + image_tpl = "g_demo_plots-%i.eps" + + printf ("Plotting two dashed circles w/ a connection\n"); + gg = g_new("COL",3,"geometry",[256,256]); + tt = linspace (0,2*pi,65); xx = [sin(tt);cos(tt)]'; + gg = g_data (gg,"-join","-step",3,"x",xx,xx/2); + gg = g_cmd (gg,"set xrange [-1.1:1.1]"); + gg = g_cmd (gg,"set yrange [-1.1:1.1]"); + gg = g_cmd (gg,"set title \"Two dashed circles w/ a connection\""); + ## Example of token substitution and printf directive + gg = g_cmd (gg,"printf:plot 'x' w lp lc <COL> lw %i pt 7 ps 4 ",3,"/printf:"); + ##gg = g_cmd (gg,"plot 'x' w lp ls <COL>"); + ## ls(gg.dir) + + if save_snapshots + plot_extras = {sprintf(image_tpl, g_demo_plot_cnt++)}; + end + g_plot (gg, "-wait","COL",2, plot_extras{:}); + ##system (["less ",gg.dir,"/x"]) + printf ("Don't forget to close the plot window\n"); + printf ("Hit any key for the next plot\n"); + pause; + hh = g_new("geometry","640x330"); + hh = g_cmd (hh,\ + "pr:1:set multiplot title \"Two (%i) of the same\"", 2,\ + "set size 0.5,0.9",\ + "set origin 0,0",\ + _g_instantiate (gg,"COL",1),\ + "set origin 0.5,0",\ + gg,\ + "set size 1,1",\ + "set origin 0,0"\ + ); + if save_snapshots + plot_extras = {sprintf(image_tpl, g_demo_plot_cnt++)}; + end + g_plot (hh, "-wait",plot_extras{:}); + pause + ff = g_new("geometry","400x400"); + ff = g_cmd (ff,\ + "pr:1:set multiplot title \"Four (%i) of the same\"", 4,\ + g_locate (_g_instantiate (gg,"COL",1),[0.0, 0.0, 0.45, 0.45]),\ + g_locate (_g_instantiate (gg,"COL",2),[0.55, 0.0, 0.45, 0.45]),\ + g_locate (_g_instantiate (gg,"COL",3),[0.0, 0.5, 0.45, 0.45]),\ + g_locate (_g_instantiate (gg,"COL",4),[0.55, 0.5, 0.45, 0.45])\ + ); + if save_snapshots + plot_extras = {sprintf(image_tpl, g_demo_plot_cnt++)}; + end + g_plot (ff, "-wait", plot_extras{:}); + pause + + printf ("Plotting surfaces"); + [xx,yy] = meshgrid (linspace (-3*pi,3*pi,51)); + zz = sin (sqrt (xx.^2 + yy.^2)) ./ (sqrt (xx.^2 + yy.^2)); + zz(isnan(zz)) = 1; + ## zz = cos (2*pi*xx) .* (1-yy.^3) - yy.^2; + ii = g_new (); + ii = g_data (ii, "-step",51, "mygrid", [xx(:),yy(:),zz(:)]); + ii = g_cmd (ii, "set hidden3d", "splot 'mygrid' w lines"); + if save_snapshots + plot_extras = {sprintf(image_tpl, g_demo_plot_cnt++)}; + end + g_plot (ii, "-wait",plot_extras{:}); + + + jj = g_new ("wait",1); + jj = g_data (jj, "mygrid", zz); + jj = g_cmd (jj, "set hidden3d", "splot 'mygrid' matrix w pm3d, 'mygrid' matrix w lines title ''"); + if save_snapshots + plot_extras = {sprintf(image_tpl, g_demo_plot_cnt++)}; + end + g_plot (jj,plot_extras{:}); + + printf ("Plotting images in 2D and 3D"); + imgdata = 64*kron(ones(4), eye(2)) + linspace(0,128,8)'*ones(1,8); + + kk = g_new ("wait",1,"geometry",[400,400]); + kk = g_data(kk, "-uint8","checker",imgdata); + kk = g_cmd (kk, \ + "set palette gray",\ + "set title 'Binary array: Checkerboard seen in 2D'",\ + "plot 'checker' binary array=8x8 flipy format='%uchar' with image",\ + "pause 1",\ + "pause -1",\ + "set title 'Binary array: Checkerboard seen in 3D'",\ + "splot [0:9] [0:9] 'checker' binary array=8x8 flipy perp=(0,1,0) center=(4,4,4) format='%uchar' with image"); + + if save_snapshots + plot_extras = {sprintf(image_tpl, g_demo_plot_cnt++)}; + end + g_plot (kk,plot_extras{:}); + + + + ll = g_new ("wait",1); + ll = g_data(ll, "sombrero",zz); + ll = g_cmd (ll, \ + "set palette gray",\ + "set title 'Image saved as text matrix: Sombrero'",\ + "splot [-25:25] [-25:25] 'sombrero' matrix using ($1-25):($2-25):($3) with image"); + + if save_snapshots + plot_extras = {sprintf(image_tpl, g_demo_plot_cnt++)}; + end + g_plot (ll,plot_extras{:}); + + zrgb = reshape ([zz(:),-zz(:),abs(zz(:))]',size(zz).*[3,1]); + zrgb -= min(zrgb(:)); + zrgb *= 255/max(zrgb(:)); + mm = g_new ("wait",1); + mm = g_data(mm, "-uint8","sombrero",zrgb); + mm = g_cmd (mm, \ + "set title 'Image saved as text matrix: Sombrero'",\ + "plot 'sombrero' binary array=51x51 origin=(-25,-25) format='%uchar%uchar%uchar' with rgbimage"); + + if save_snapshots + plot_extras = {sprintf(image_tpl, g_demo_plot_cnt++)}; + end + g_plot (mm,plot_extras{:}); + + + g_delete (gg); + g_delete (hh); + g_delete (ff); + g_delete (ii); + g_delete (jj); + g_delete (kk); + g_delete (ll); + g_delete (mm); + + if save_snapshots + all_figs = sprintf ([image_tpl," "],1:g_demo_plot_cnt-1); + printf ("Viewing saved figures %s\n",all_figs); + system (["eog ", all_figs]); + end + +endfunction +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_ez.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,486 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. +function g = g_ez (varargin) +### g = g_ez (command, args,...) - Single-command plotting function +### +### This function allows to do basic plots with a single function call, i.e. +### like octave's plot() commant. +### +### If no output argument is required, the plot is shown and all data created +### for this plot is deleted. Otherwise use, g_plot(g) to plot g. +### +### Commands: +### --------- +### "plot", <PLOT_DATA>, where the plotted data can be 2D points or images +### 2D data can be specified by a two-column matrix of 2D points, +### optionnally followed by a cell array of label strings +### +### "plot", x, y, fmt,... : Reads arguments like in octave's plot (x,y,fmt,...) +### fmt can be an octave-like formatting, e.g. "-;My Key;", see +### _g_parse_oct_fmt(). +### or "img", which may be followed by "range", "xrange", "yrange", +### "colormap" options. See _g_image_cmd(). +### "geometry",[w,h] : Set gnuplot window geometry +### "FILE.(eps|fig)" : Plot to FILE.eps or FILE.fig file. +### "xrange", [min,max] : Set horizontal range +### "yrange", [min,max] : Set vertical range +### "xlabel", str : Set x label +### "ylabel", str : Set y label +### "title", str : Set title +### "cmd", str : Insert command str. +### "grid", : Same as "cmd","set grid" +### "xgrid", +### "ygrid" : Same as "cmd","set grid x" +### "xtics", arg : If arg is a non-empty string, then this adds the +### command ["set xtics " arg]. If arg is empty, same as +### "unset xtics". +### "ytics", arg : Same as "cmd","set ytics " arg +### "color", yesno +### "display", yesno +### +### TODO: "hist", "mesh" etc ... + + ## args = struct(); + args.cmds = {}; + filename = ""; + + # Read arguments and put them in args. + + cnt = 1; # Arg counter + nplots = 0; # Plot counter + plotcmds = ""; # arguments to plot + step = zeros(1,0); # Number of points per "plot" curve + stop = {}; + N = length (varargin); + plots = {}; # Plotted data + names = {}; # Names of data files + labels = {}; # Labels of each dataset + dataLabels = {}; # Labels attached to individual data points + do_color = 1; + do_wait = 1; + do_display = 1; + labpos = zeros(0,2); + img_indices = zeros(1,0); + + args.xmap = args.ymap = args.map = []; + + while cnt < N + cmd = varargin{cnt}; + if !ischar (cmd) + error ("Expecting string, got a '%s' as %ith argument",\ + typeinfo(cmd),cnt); + end + + # It's a filename + if length (cmd) > 3 \ + && (strcmp (cmd(end-3:end), ".eps") \ + || strcmp (cmd(end-3:end), ".fig")\ + || strcmp (cmd(end-3:end), ".png")) +# || strcmp (cmd(end-3:end), ".ppm")\ +# || strcmp (cmd(end-3:end), ".pgm")\ +# || strcmp (cmd(end-3:end), ".jpg")) + filename = cmd; + cnt++; + continue + endif + + switch cmd + + case {"title", "xlabel", "ylabel", "x2label", "y2label"}, + str = varargin{++cnt}; + if !ischar (str), + error ("Option '%s' requires a char argument; got a %s",\ + cmd, typeinfo (str)); + endif + #str = strrep (str,"%","\\%") + args.(cmd) = str; + + case "color" + do_color = varargin{++cnt}; + + case {"display", "-display"} + do_display = varargin{++cnt}; + + case "label" + + str = varargin{++cnt}; + if !ischar (str), + error ("Option '%s' requires a char argument; got a %s",\ + cmd, typeinfo (str)); + endif + pos = varargin{++cnt}; + if !isnumeric (pos), + error ("Option '%s' requires a 1 x 2 matrix argument; got a %s",\ + cmd, typeinfo (pos)); + endif + if length (pos) != 2 + error ("Option '%s' requires a 1 x 2 matrix argument; got %s",\ + cmd, sprintf("%i x",size (pos))(1:end-2)); + endif + labels = {labels{:},str}; + labpos = [labpos;pos]; + #str = strrep (str,"%","\\%") + case {"geometry", "xrange", "yrange", "x2range", "y2range"}, + args.(cmd) = varargin{++cnt}; + + case {"range"}, + args.xrange = args.yrange = varargin{++cnt}; + + case "grid" + args.grid = ""; + case "xgrid" + args.grid = "x"; + case "ygrid" + args.grid = "y"; + + case "xmap" + args.xmap = varargin{++cnt}; + case "ymap" + args.ymap = varargin{++cnt}; + + case "plot" + do # Add following datasets + nplots++; + + foundLabels = {}; # Labels for datapoints + + data = varargin{++cnt}; + if !isnumeric (data) + error ("Argument after 'plot' should be numeric. Got '%s'.",\ + typeinfo(data)); + endif + orig_data_size = size (data); + if rows (data) == 1, data = data'; endif + ##nplots + ##step + ##rows(data) + ##keyboard + step(1,nplots) = rows (data); + + if cnt < length (varargin) + if isnumeric (varargin{cnt+1}) # x and y are separate args + tmp = varargin{++cnt}; + if prod (size (tmp)) != prod (size (data)) + if rows (data) != rows (tmp) + if rows (data) == columns (tmp) + tmp = tmp'; + end + end + if rows (data) == rows (tmp) \ + && columns (data) == 1 + data = data*ones(1,columns(tmp)); # Replicate abscissa data + else + error ("First 'plot' arg is %i x %i, while 2nd is %i x %i\n",\ + orig_data_size, size (tmp)); + endif + endif + if !xor (isuint(data), isuint(tmp)) # Octave's stupid bug + data = [data(:), tmp(:)]; + else + data = [double(data(:)),double(tmp(:))]; + end + else + if columns(data) == 1 + data = [(1:rows(data))', data]; + end + endif # EOF x and y are separate args + else + if columns(data) == 1 + data = [(1:rows(data))', data]; + end + end + # Transpose data, if needed. + if rows(data)==2 && columns(data)>2, data = data'; endif + + names{nplots} = sprintf ("data%i",nplots); + # Determine how to plot it + try_arg = []; + if cnt < N + try_arg = varargin{cnt+1}; + endif + # Labels passed as a vector: turn into a cell + if isnumeric (try_arg) && ! isempty (try_arg) + if numel (try_arg) > rows (data) + error (["Don't know what to do with third numeric argument of size",\ + sprintf(" %i",size(try_arg)),". Plot has has %i points"],\ + rows(data)); + end + try_arg = num2cell (try_arg); + end + ##foundLabels + if iscell (try_arg) # user-specified labels + foundLabels = try_arg; + cnt++; + try_arg = 0; + if cnt < N + try_arg = varargin{cnt+1}; + endif + end + if ischar (try_arg) && strcmp (try_arg, "img") + + zrange = [min(data(:)), max(data(:))]; + ##data = floor (255.999*(data - zrange(1))/diff(zrange)); + + [imFmt, extra, nImArgs,zrange] = _g_image_cmd (size (data), zrange, args, {varargin{cnt+2:end}}); + + cnt += nImArgs + 1; + + data = floor (255.999*(data - zrange(1))/diff(zrange)); + data(data < 0) = 0; + data(data > 255) = 255; + data(isnan (data)) = 0; + + if length (size (data)) == 3 && size(data)(3) == 3 + data = [data(:,:,1)'(:),data(:,:,2)'(:),data(:,:,3)'(:)]'; + else + data = data'; + end + plotcmds = [plotcmds,"'", names{nplots},"' ",imFmt,", "]; + img_indices = [img_indices, nplots]; + args.cmds = {args.cmds{:}, extra{:}}; + + # EOF "img" + elseif ischar (try_arg) && strcmp (try_arg, "box") # Unused for now + + interlaced = prod (orig_data_size) == rows (data) + if !interlaced + nbox = prod (orig_data_size); + datlen = rows (data)/nbox; + data1 = data(1:datlen,1); + data2 = reshape (data(:,2), nbox, datlen)'; + else + datindices = data(:,1); + #data1 = create_set (data(:,1)); + data1 = unique (data(:,1)); + nbox = length (data1); + data2 = data(:,2); + end + data = zeros(0,2); + stops = zeros(1,0); + + for i = 1:nbox + if !interlaced, the_data = data2(:,i); + else the_data = data2(data1(i) == datindices); + end + boxData = boxplot_data (the_data); + boxWid = 0.1; + data = [data;\ + [ data1(i)+boxWid*[1 -1 -1 1 1 -1 -1]/2;\ + boxData.quantiles([3 3 2 2 4 4 3])']';\ + [ data1(i)*[1 1 1 1];\ + boxData.quantiles([1 2 4 5])']';]; + stops = [stops, [7 9 11]+11*(i-1)]; + end + + cnt += 1; + plotcmds = [plotcmds, "'", names{nplots},"' ","w l title '' , "]; + stop{nplots} = stops; + + # EOF "box" + else # Plain N x 2 data + + [isFmt, fmtContents, wantLabel] = _g_parse_oct_fmt (try_arg, nplots,foundLabels); + + cnt += isFmt; + if wantLabel + dataLabels{nplots} = 1; + else + dataLabels{nplots} = 0; + end + if !isempty (foundLabels) + dataLabels{nplots} = foundLabels; + end + plotcmds = [plotcmds,"'",names{nplots},"' ",fmtContents,", "]; + if wantLabel + plotcmds = [plotcmds,"'",names{nplots},"' ",wantLabel,", "]; + end + end + plots{nplots} = data; + # Determine how to plot it + + # EOF read datasets + until (cnt >= N) || !isnumeric (varargin{cnt+1}); + + # EOF case plot + case "cmd" + args.cmds = {args.cmds{:}, varargin{++cnt}}; + + case "wait" + do_wait = varargin{++cnt}; + + case {"xtics","ytics", "x2tics", "y2tics", "tics"}, + t = varargin{++cnt}; + args.(cmd) = t; + + otherwise + error ("Unknown command '%s'", cmd); + endswitch + cnt++; + endwhile # EOF Read arguments and put in struct + + # Transform args in a gnuplot_object + + if struct_contains (args, "geometry"), g = g_new ("geometry", args.geometry); + else g = g_new (); + endif + + # Special case: quote title + #if struct_contains (args, "title"), args.title = ["'",args.title,"'"]; endif + + if length (args.cmds), g = g_cmd (g, args.cmds{:}); endif + + # set all in g.cmds + tmp = {"title", \ + "xrange", "yrange", "y2range", "x2range", \ + "xlabel", "ylabel", "x2label", "y2label", \ + "grid", "xgrid", "ygrid"}; + for i = 1:length(tmp) + if struct_contains (args, tmp{i}) + value = args.(tmp{i}); + val_str = _g_stringify (tmp{i}, value); + g = g_cmd (g,["set ",tmp{i}," ",val_str,""]); + endif + endfor + for i = 1:length(labels) + g = g_cmd (g,"pr:3:set label %i \"%s\" at screen %g,%g",i,labels{i},labpos(i,:)); + endfor + + if nplots + + for j = 1:3 + + Z = {"x","y",""}{j}; + Zmap = [Z,"map"]; + Ztics = [Z,"tics"]; + Zrange = [Z,"range"]; + + if ! isempty (args.(Zmap)) && ! struct_contains (args,Ztics) # Must figure tics for map + + if struct_contains(args,Zrange) # Determine range + rng = args.(Zrange); + else + rng = [inf,-inf]; + for i = 1:nplots + if all (img_indices != i) + rng = [min(rng(1), min (plots{i}(:,1))), \ + max(rng(2), max (plots{i}(:,1)))]; + end + end + assert (all (isfinite (rng))) + end + args.(Ztics) = _g_default_tics (rng); + end + if struct_contains(args,Ztics) + + if isempty (args.(Ztics)) # No tics + + g = g_cmd (g,["unset ",Ztics]); + + # Explicit command tics + elseif ischar (args.(Ztics)) + + g = g_cmd (g, ["set ", Ztics, " ", args.(Ztics)]); + + # Numerical tics + else + Zmajor = {}; + if any (isnan (args.(Ztics))) # FIXME only works for vector args.(Ztics) + imajor = find(isnan (args.(Ztics))); + imajor -= cumsum(isnan (args.(Ztics)))(imajor) - 1; + Zmajor = {"major",imajor}; + args.(Ztics) = args.(Ztics)(! isnan (args.(Ztics))); + end + if ! isempty (args.(Zmap)) && isvector (args.(Ztics)) + args.(Ztics) = [_g_map(args.(Zmap), args.(Ztics)(:)'); args.(Ztics)(:)']; + g = g_cmd (g, _g_tics (args.(Ztics)(1,:), args.(Ztics)(2,:), Z, Zmajor{:})); + else + g = g_cmd (g, _g_tics (args.(Ztics), args.(Ztics), Z, Zmajor{:})); + end + end + end + end # EOF loop over x, y + + for i = 1:nplots + + if all (img_indices != i) + + plots{i}(:,1) = _g_map (args.xmap, plots{i}(:,1)); + plots{i}(:,2) = _g_map (args.ymap, plots{i}(:,2)); + if length (stop) >= i && ! isempty (stop{i}) + pre_args = {"-stops",stop{i}}; + else + pre_args = {"-step", step(i)}; + end + + if ! (isscalar (dataLabels{i}) && !dataLabels{i}) + pre_args = {pre_args{:}, "-label", dataLabels{i}}; + end + + g = g_data (g,pre_args{:}, names{i}, plots{i}); + + else + g = g_data (g,"-uint8", names{i}, plots{i}); + end + endfor + ##plotcmds + g = g_cmd (g,["plot ",plotcmds(1:end-2)]); + endif + # EOF Transform args in a gnuplot_object + if nargout < 1 || length(filename) || do_display + extras = {"-color",do_color}; + if do_wait + extras = {extras{:}, "-wait"}; + endif + if ! do_display + extras = {extras{:}, "-display", 0}; + endif + if filename, g = g_plot (g,filename,extras{:}); + else g = g_plot (g,extras{:}); + endif + if struct_contains (g, "double_clicks") + printf ("Double-clicked locations:\n"); + g.double_clicks + end + if struct_contains (g, "middle_clicks") + printf ("Middle-clicked locations:\n"); + g.middle_clicks + end + filename = ""; + if nargout < 1 + "deleting" + g_delete (g); + clear g; + else + "not deleting" + endif + endif +endfunction + + +%!demo +%! im = rand(16,31); +%! im(3:10,5:25) = linspace(0,0.5,8)'*ones(1,21)+ones(8,1)*linspace(0,0.5,21); +%! g_ez ("title","A random grey image","plot",im, "img") +%! %------------------------------------------------- +%! % a random greylevel image + +%!demo +%! t=linspace(-pi,pi,101); x = sin(t); y = sin (t+pi/3); +%! g_ez ("title","Some sines","plot",t,x,"-",t,y,"-") +%! %------------------------------------------------- +%! % some sines + +%!demo +%! im = rand(16,31,3); +%! im(3:10,5:25,1) = linspace(0,1,8)'*ones(1,21); +%! im(3:10,5:25,2) = 0.5; +%! im(3:10,5:25,3) = 1; +%! g_ez ("xrange",[-1,1],"plot",im*255, "img") +%! %------------------------------------------------- +%! % a random color image + + + + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_locate.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,45 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function g = g_locate (g, newloc) +### g = g_locate (g, [posx, posy, width, height]) - Set the origin and size of g +### +### This function replaces all "set scale W,H" by "set scale width*W,height*H" +### and "set origin X,Y" by "set origin posx+height*X,posy+widthY". +### +### See also: g_new,... + + _g_check (g); + + ##printf ("Re-locating g at '%s'\n",g.dir); + + found_origin = found_size = 0; + for i = 1:length (g.cmds) + [dums,dume,dumte,dumm,toks] = \ + regexp (g.cmds{i}, '^set\s*(origin|size)\s*([^,\s]+)\s*,\s*([^,\s]+)'); + if length (toks) + args = [str2num(toks{1}{2}), str2num(toks{1}{3})]; + + if strcmp (toks{1}{1}, "origin") + found_origin = 1; + args = args .* newloc(3:4) + newloc(1:2); + elseif strcmp (toks{1}{1}, "size") + found_size = 1; + args = args .* newloc(3:4); + else + error ("First token isn't what I thought, but '%s'",toks{1}{1}); + endif + g.cmds{i} = sprintf ("set %s %g,%g",toks{1}{1}, args); + endif + endfor + + if ! found_size && any ((newloc(1:2)) || any (newloc(3:4)!= 1)) + g.cmds = {sprintf("set size %g,%g",newloc(3:4)),\ + g.cmds{:}}; + endif + if ! found_origin && any (newloc(3:4)!= 1) + g.cmds = {sprintf("set origin %g,%g",newloc(1:2)),\ + g.cmds{:}}; + endif + +endfunction +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_new.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,59 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. +function g = g_new (varargin) +### g = g_new ( ...) - Create a new gnuplot_object and its directory +### +### The g_XYZ() functions allow Octave to create plots with Gnuplot. They +### are little more than an Octave front-end to Gnuplot, but allow to do +### anything Gnuplot can do directly from Octave. In addition, there are some +### commodity functions (g_cmd() with struct arg, g_locate()) that allow to nest +### one figure in another. +### +### g_new() creates a temporary directory in which data and commands will be +### stored in a gnuplot-readable format. +### +### g_new accepts key, value pairs of arguments, which will be passed to g_set. +### +### Typical usage: +### +### g = g_new (<my options, e.g. on how to display>) +### g = g_data (g, "myChosenDataFileName", data, ...) +### g = g_cmd (g, <gnuplot commands, e.g.>,\ +### "plot 'myChosenDataFileName' with lines",...); +### g_plot (g,<options on how to plot, e.g. to file>); +### +### +### DEMO: Run g_demo(), or see http://gnuplot.sourceforge.net/demo_4.1 on how to +### do nice plots. +### +### SEE ALSO: g_ez, g_delete, g_data, g_cmd, g_plot, g_set, g_locate. +### +### TODO: an OO style of function call (see failed attempt at end of g_new code) + g.type = "gnuplot_object"; + g.cmds = {}; # Gnuplot commands + g.owns = {}; # Directories of other gnuplot_objects that have + # been added to g, and must be cleaned when g is + # deleted. + g.dir = tmpnam(); # Directory that contains g's data etc + g.values = struct(); # Plot variables, e.g. "geometry", "title" + + g = g_set (g, varargin{:}); + + if !mkdir (g.dir), + error ("Couldn't create '%s'",g.dir); + endif + + mypid = getpid(); + pidfname = sprintf ("%s/PID-%i.txt", g.dir, mypid); + [fid, msg] = fopen (pidfname,"w"); + if fid<0, + error ("Can't open pid file '%s': %s", pidfname, msg); + endif + fprintf (fid,"%i\n", mypid); + fclose (fid); + + ##printf ("Created g at '%s'\n",g.dir); + + #g.plot = inline ("g_plot (g,varargin{:})"); + #g.data = inline ("g_data (g,varargin{:})"); + #g.cmd = inline ("g_cmd (g,varargin{:})"); +endfunction
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_plot.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,296 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. + +function g = g_plot (g, varargin) +### g = g_plot (g,...) - Plot a gnuplot_object +### +### If g.values has a field "geometry" of the form, [width, heigth] or +### "<width>x<height>, it will be used to set the geometry, in pixels of the +### gnuplot window. +### +### +### +### OPTIONS: +### "geometry",geometry +### +### "-wait" : Gnuplot does not exit immediately, which allows to manipulate the +### plot with the mouse. +### +### Any string ending in '.eps' causes postscript output. The plot is output to +### that file, and the file is viewed using ggv. +### +### "-display", yesno : View eps file or not (senseless unless an eps was saved) +## +### "-color", yesno : In color or monochrome (for eps and fig) +### +### All optional arguments other than the options above will be passed to +### _g_instantiate before plotting. +### +### TODO: Have a better choice of postscript viewers (e.g. gv ...) +### Do the same for .pdf, .fig and .png arguments. +### +### See also: g_new,... + + _g_check (g); + + do_eps = 0; + do_fig = 0; + do_png = 0; +# do_ppm = 0; +# do_pgm = 0; +# do_jpg = 0; + do_display = 1; + outputFile = ""; + gnuplot_options = ""; + geometry = []; + pre_cmd = {}; + pos_cmd = {}; + do_color = 1; + + wait_for_q = struct_contains (g.values, "wait") && g.values.wait; + + if 0 + eps_viewer = "ggv"; + else + eps_viewer = "gv"; + end + if 0 + png_viewer = "qiv"; + elseif 0 + png_viewer = "xzgv"; + elseif 0 + png_viewer = "display"; + else + png_viewer = "eog"; + end + + i = 1; + keep = ones (1,length(varargin)); # Opts that'll be passed to _g_instantiate + while i <= length (varargin) + opt = varargin{i++}; + ll = length(opt); + if ll>=4 \ + && (strcmp (opt(ll-3:ll), ".eps") \ + || strcmp (opt(ll-3:ll), ".fig") \ + || strcmp (opt(ll-3:ll), ".png")) + + if do_eps || do_fig || do_png, + printf ("Will save to '%s'\n",opt); + end + switch opt(ll-3:ll) + case ".eps", do_eps = 1; + case ".fig", do_fig = 1; + case ".png", do_png = 1; + endswitch + + outputFile = opt; + keep(i-1) = 0; + + elseif strcmp (opt, "-wait") + wait_for_q = 1; + keep(i-1) = 0; + + elseif strcmp (opt, "geometry") + + geometry = varargin{i++}; + keep([i-2,i-1]) = 0; + + elseif strcmp (opt, "-display") + if i > length (varargin) \ + || (i == length(varargin) && !isnumeric (varargin{i})) + do_display = 1; + keep([i-1]) = 0; + else + do_display = varargin{i++}; + keep([i-2,i-1]) = 0; + endif + elseif strcmp (opt, "-color") + if i > length (varargin) \ + || (i == length(varargin) && !isnumeric (varargin{i})) + do_color = 1; + keep([i-1]) = 0; + else + do_color = varargin{i++}; + keep([i-2,i-1]) = 0; + endif + else + ##error ("Unknown option '%s'",opt); + endif + endwhile # EOF reading options + + # Make outputFile absolute + if length(outputFile) && outputFile(1) != "/" + outputFile = [pwd(),"/",outputFile]; + endif + + if do_eps + if isempty (geometry) + if ! struct_contains (g.values, "geometry") + geometry = [10,8]; + else + geometry = g.values.geometry; + if ischar(geometry) + geometry = strrep (geometry, "x", " "); + geometry = eval (["[",geometry,"]"]) + endif + geometry ./= 28; + endif + endif + elseif do_png + if isempty (geometry) + if ! struct_contains (g.values, "geometry") + geometry = [600,400]; + else + geometry = g.values.geometry; + if ischar(geometry) + geometry = strrep (geometry, "x", " "); + geometry = eval (["[",geometry,"]"]) + endif + ##geometry .*= 72; + endif + endif + endif + if do_color, colorStr = "color"; else colorStr = "monochrome"; end + if do_eps + + pre_cmd = {sprintf("set term postscript eps %s size %.1fcm,%.1fcm 20",colorStr,geometry),\ + ["set out '",outputFile,"'"]}; + + elseif do_fig + pre_cmd = {sprintf("set term fig big landscape metric %s fontsize 20 ",colorStr),\ + ["set out '",outputFile,"'"]}; + + elseif do_png + + if do_color + pcolors = "xffffff x000000 x000000 xc00000 xa0ffa0 x0000ff xE0E000 x00E0E0 xE000E0 x000000"; + else + pcolors = "xffffff x000000 x000000 x000000 x808080 xA0A0A0 xE0E0E0 x404040 xC0C0C0 x202020"; + end + pre_cmd = {sprintf("set term png truecolor size %i, %i %s",geometry, pcolors),\ + ["set out '",outputFile,"'"]}; + + elseif wait_for_q # Not eps and -wait + + pre_cmd = {pre_cmd{:},\ + "set mouse",\ + "set mouse labels",\ + "set mouse verbose"\ + }; + + pos_cmd = {pos_cmd{:},\ + "pause -1"}; + + ## FIXME: gnuplot croaks w/ warning: Mousing not active, even if I've set mouse.. + ## "pause mouse keypress"}; + + ## This hack does not work either + #,\ "if (MOUSE_KEY != 113) reread"}; + + else # Neither eps nor -wait + gnuplot_options = " -persist "; + endif + g = _g_instantiate (g,varargin{find(keep)}); + + + cmd_str = sprintf ("%s\n",pre_cmd{:},g.cmds{:},pos_cmd{:}); + + ## Redundant w/ geometry treatment above? + if !isempty (geometry) + if !ischar (geometry), + opt_str = sprintf ("%ix%i",geometry); + else + opt_str = geometry; + endif + gnuplot_options = [gnuplot_options," -geometry ",opt_str," "]; + + elseif struct_contains (g.values, "geometry") + if !ischar (g.values.geometry), + opt_str = sprintf ("%ix%i",g.values.geometry); + else + opt_str = g.values.geometry; + endif + gnuplot_options = [gnuplot_options," -geometry ",opt_str," "]; + endif + + ## Hack for png font + if do_png, cmd_str = strrep (cmd_str, "Times-Roman",""); endif + cmdfname = [g.dir,"/cmds.plt"]; + [fid, msg] = fopen (cmdfname,"w"); + if fid<0, + error ("Can't open command file '%s': %s", cmdfname, msg); + endif + fprintf (fid,"cd '%s'\n",g.dir); + fprintf (fid, "%s", cmd_str); + fclose (fid); + + ##system (["cat ",cmdfname]); + gnuplot_command = [g_config("gnuplot_program")," ",gnuplot_options,\ + " ",cmdfname]; + + output_file = [g.dir,"/gnuplot-output.txt"]; + gnuplot_command = [gnuplot_command, " 2>&1 | tee ",output_file]; + + status = system (gnuplot_command); + [status2, msg] = system (["cat ",output_file]); + + if !status + + tokens = regexp (msg, 'put\D*([\+\-\d\.]+)\D+([\+\-\d\.]+)', "tokens"); + if length (tokens) + double_clicks = zeros (length (tokens),2); + for i=1:length (tokens) + # Strangely eval seems faster than str2double + double_clicks(i,1) = eval (tokens{i}{1}); + double_clicks(i,2) = eval (tokens{i}{2}); + end + ##if struct_contains (g, "double_clicks") + ##g.double_clicks = [g.double_clicks; double_clicks]; + ##else + ## Keep only clicks from last plot + g.double_clicks = double_clicks; + ##end + end + + tokens = regexp (msg, 'set label\D*([\+\-\d\.]+)\D+([\+\-\d\.]+)', "tokens"); + if length (tokens) + middle_clicks = zeros (length (tokens),2); + for i=1:length (tokens) + # Strangely eval seems faster than str2double + middle_clicks(i,1) = eval (tokens{i}{1}); + middle_clicks(i,2) = eval (tokens{i}{2}); + end + ##if struct_contains (g, "middle_clicks") + ##g.middle_clicks = [g.middle_clicks; middle_clicks]; + ##else + ## Keep only clicks from last plot + g.middle_clicks = middle_clicks; + ##end + end + + else + printf ("Couldn't run gnuplot: Exited, saying \n%s\n",msg); + #keyboard + endif + + if do_display + if do_eps + [status, msg] = system ([g_config("eps_viewer")," ",outputFile]); + if status + error ("Couldn't run %s: Exited, saying \n%s\n",eps_viewer, msg); + endif + elseif do_fig + [status, msg] = system (["xfig ",outputFile]); + if status + error ("Couldn't run xfig: Exited, saying \n%s\n",msg); + endif + elseif do_png + [status, msg] = system ([g_config("png_viewer")," ",outputFile]); + if status + error ("Couldn't run %s: Exited, saying \n%s\n",png_viewer, msg); + endif + endif + endif + ##keyboard + if nargout<1, clear g; endif +endfunction +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/g_set.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,21 @@ +### Copyright (c) 2007, Tyzx Corporation. All rights reserved. +function g = g_set (g, varargin) +### g = g_set (g, key, value, ...) - Set values.(key) = value +### +### Used values: +### "title", string : Title of the plot. Used (only; TODO; should be +### used always) if this plot is later inserted in +### another plot. +### +### "geometry", "WxH" or [W,H] : Geometry of plot, used by g_plot. +### +### See also: g_new,... + _g_check (g); + i = 1; + while i < length (varargin) + key = varargin{i++}; + value = varargin{i++}; + g.values.(key) = value; + endwhile +endfunction +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/isuint.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,5 @@ +## yesno = isuint (x) +function yesno = isuint (x) + +typ = typeinfo (x); +yesno = length (typ) > 3 && strcmp (typ(1:4), "uint"); \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extra/gnuplot/inst/myimage.m Fri Jan 22 05:29:58 2010 +0000 @@ -0,0 +1,518 @@ +## im2 = myimage (im,...) - Make im viewable by normalizing greylevels and more +## +## Scales the values of im so that they range in [0,255]. The smallest element +## of im (or range(1), if the "range" option is used) is mapped to zero, and the +## largest (or range(2)) is mapped to 255. +## +## If both dimensions are less than 180, +## +## If the save option is not used, and nargout is 0, then im2 will be displayed, +## rather than returned. NaN and Inf pixels become black or, if the image is +## saved as a .png or .gif, transparent. +## +## OPTIONS: +## -------- +## "range", [min,max] : Graylevel range to be mapped to 0:255. +## Default:[min(im(:)),max(im(:))] +## "qrange", [minq,maxq]: Map quantiles between minq and maxq to 0 and 255. +## "minsz", [Rows,Cols] : Minimum dims of im2. im will be scale by an integral +## factor so that at least one of its dimensions matches +## minsz. Default: [180 180] +## "scl", scl : Scale image size up (scl>1) or down (scl<1) +## "invert" : Invert image (black becomes white and vice versa). +## +## "is_col" : Color image, consecutive rows being R, G and B. +## "colormap", : Convert greylevel image to a 'rainbow' colormap +## +## "show_range" : Place a graylevel scale below image. +## "scale_sz",sz : Width of graylevel scale. Implies show_range. +## +## "text", [x,y], str : Annotate image with str, at position x,y, with size sz +## "text", [x,y,sz],str +## "line", [x,y,x,y,R,G,B,W] or +## "line", [x,y,x,y,R,G,B] or +## "line", [x,y,x,y,C,W] or +## "line", [x,y,x,y,C] or +## "line", [x,y,x,y] +## +## "save", filename : Save im2 in filename. +## "display", yesno : Display im2 or not. Default: False iff save requested +## or nargout!=0. +## +## EXAMPLES: type "demo myimage" to run the examples below +## --------- +## myimage (randn(3,3), "show_range") +## myimage (rand(9,3), "is_col") +## myimage (randn(32,32), "minsz",[32,50]) +## myimage (ones(64,1)*linspace(0,1,256), "colormap") +## myimage (linspace(0,3,256)'*ones(1,64), "range",[3 1]) +## myimage (zeros(200,200), "text",[10,20],">> 1 + pi\nans = 4.1416\n>>") +## +## im = kron (ones(4), kron (eye(2),ones(10))); +## im += ones (80,1)*linspace(0,1/2,80); +## myimage (im,"text",[11,5],"Hello","text", [10,30,30],"world") +## +## FIXME: scl < 1 seems to be buggy + +### Author Etienne Grossmann <etienne@isr.ist.utl.pt> +function im = myimage (im, varargin) + +##viewer = "qiv"; # If I need to display image +##viewer = "feh"; +##viewer = "display"; +viewer = "eog"; + +is_col = 0; +invert = 0; +sameScale = 1; # Use same greylevel scale for R, G and B +show_range = 0; +scale_sz = 0; +vrange = []; +qrange = []; +minsz = 180; +maxsz = 640; +colormap = 0; +filename = 0; +text = {}; +line = {}; +do_show = !nargout; +dont_wait = ""; +roi = []; +scl = nan; + +if nargin > 1 + + cnt = 1; + # For compat w/ old style + if ! ischar (varargin{cnt}), is_col = varargin{cnt++}; end + while cnt <= length (varargin) + + opt = varargin{cnt++}; + if ! ischar (opt) + error ("Expecting option name, got a %s",typeinfo(opt)) + endif + switch opt + case "scl", scl = varargin{cnt++}; + case "ROI", roi = varargin{cnt++}; + case "save", filename = varargin{cnt++}; + case "range", vrange = varargin{cnt++}; + case "qrange", qrange = varargin{cnt++}; + case "minsz", minsz = varargin{cnt++}; + case "do_show", do_show = varargin{cnt++}; + case "viewer", viewer = varargin{cnt++}; do_show = 1; + case "display", viewer = "display"; do_show = 1; + case "gimp", viewer = "gimp"; do_show = 1; dont_wait = "&"; + case "qiv", viewer = "qiv"; do_show = 1; dont_wait = "&"; + if cnt<=length(varargin) && isnumeric(varargin{cnt}) + printf ("Warning: option 'display' now takes no arg\n"); + end + case "invert", invert = 1; + case "is_col", is_col = 1; + case "colormap", colormap = 1; + if cnt<=length(varargin) && isnumeric(varargin{cnt}) + colormap = varargin{cnt++}; + if columns (colormap) != 3 + error ("colormap's optional argument has %i != 3 columns", columns(colormap)); + end + colormap /= max (colormap(:)); + end + case "show_range", show_range = 1; + case "scale_sz", show_range = 1; scale_sz = varargin{cnt++}; + case "circle", circle = {circle{:},varargin{cnt++}}; + case "line", line = {line{:},varargin{cnt++}}; + case "text", text = {text{:},varargin{cnt+[0,1]}}; cnt += 2; + otherwise error ("Unknown option '%s'", opt); + endswitch + endwhile +endif + +if ischar(im), im = imread (im); endif +if length(size(im)) == 3, # 3D-array to 2D matrix of interlaced R,G,B + is_col = 1; + ##im = reshape + ##([im(:,:,1)(:),im(:,:,2)(:),im(:,:,3)(:)]',size(im)(1:2).*[3,1]); + im = reshape (reshape(im,prod(size(im))/3,3)',size(im)(1:2).*[3,1]); +endif +[R,C] = size(im); +im(!isfinite(im)) = nan; + +R0 = R; C0 = C; + +if prod (size (maxsz)) == 1, maxsz = maxsz*[1 1]; endif +if isnan (scl) && ((R>maxsz(1)*(1+2*is_col)) || (C>maxsz(2))) + scl = ceil (max (R/(maxsz(1)*(1+is_col*2)), C/maxsz(2))) +end + +if !isnan (isnan (scl)) && scl > 1 + if is_col + im = im([1:3*scl:R;2:3*scl:R;3:3*scl:R],1:scl:C); + else + im = im(1:scl:R,1:scl:C); + endif + [R,C] = size(im); +endif + +if prod (size (minsz)) == 1, minsz = minsz*[1 1]; endif +if isnan (scl) && ((R<minsz(1)*(1+is_col*2)) && C<minsz(2)) + scl = 1 / ceil(min (minsz(1)*(1+is_col*2)/R, minsz(2)/C)); +end + +if !isnan (isnan (scl)) && scl < 1 + ## printf ("Scaling up by %i\n",scl); + scl0 = round (1/scl); + if is_col + im = reshape ([kron(im(1:3:end,:), ones (scl0))(:),\ + kron(im(2:3:end,:), ones (scl0))(:),\ + kron(im(3:3:end,:), ones (scl0))(:)]', R*scl0,C*scl0); + + else + im = kron (im, ones (scl0)); + endif + [R,C] = size(im); +end + +if isnan (scl) + scl = 1; +end + +if ! isempty (qrange) + if length (qrange) != 2 + qrange = sort ([qrange, 1-qrange]); + end + vrange = qnt (im(:),qrange); +end + +end + +## Set imin (maps to 0), imax (maps to 255) and irng ( = imax - imin) +if ! isempty (vrange) + if prod (size (vrange)) == 2 + imin = vrange(1); + imax = vrange(2); + irng = vrange(2) - vrange(1); + elseif prod (size (vrange)) == 6 + if rows (vrange) == 2, vrange = vrange'; end + imin = vrange(1:3); + imax = vrange(4:6); + irng = imax - imin; + else + error ("range should have 2 or 6 elements; got %s",\ + sprintf("%i x ",size(vrange))(1:end-3)); + end +else + if !is_col || sameScale + imin = min (im(:)); + imax = max (im(:)); + irng = imax - imin; + else + imin = min (reshape (im,3,R*C/3)'); + imax = max (reshape (im,3,R*C/3)'); + irng = imax - imin; + endif +end +if any (irng) < 0 + error ("Range ( %s) is not positive",sprintf("%f ",irng)); +endif +##length(create_set(im)) +if !is_col || sameScale + im-=imin; + if irng + im .*= 255/irng; + else + im += min (1, max (imin/255,0)); + endif +else + for j = 1:3, im(j:3:R,:) -= imin(j); endfor + for j = 1:3 + if irng(j) + im(j:3:R,:) .*= 255/irng(j); + else + im(j:3:R,:) += min (1,max (imin(j)/255,0)); + endif + endfor +endif +im(im<0) = 0; +im(im>255) = 255; +if (invert), im = 255 - im; end + +if !isempty (roi) + + roi *= scl; + #size(im) + #[min(im(:)),max(im(:))] + highlight = 64; + im(roi(2):roi(4),roi(1):roi(3)) += highlight; + im .*= 255/(255+highlight); + #size(im) + #[min(im(:)),max(im(:))]; + + +endif + + +if show_range && !is_col + # Assume graylevel + + ## scale_C, scale_R : size of scale image + if scale_sz + scale_C = max (128, scale_sz); + else + scale_C = min (max (128, C), 256); + endif + scale_R = 2*round (12*scale_C/128); + + # Image w/ room for image and scale below + scale_im0 = ones(scale_R/2,1)*linspace(0,255,scale_C); + if invert, scale_im0 = 255 - scale_im0; end + scale_im = [255+zeros(scale_R/2,scale_C);\ + scale_im0]; + tn = [tempname(),".pgm"]; + if imin && abs(log10(abs(imin)))>5, ado = sprintf ("%.3g",imin); + else ado = sprintf ("%.3f",imin); + endif + + if imin && abs(log10(abs(imax)))>5, aup = sprintf ("%.3g",imax); + else aup = sprintf ("%.3f",imax); + endif + + roundBy = 0.01; + if irng > 1-2*roundBy; + if abs (imin-round(imin)) < roundBy, ado = num2str(round(imin)); endif + if abs (imax-round(imax)) < roundBy, aup = num2str(round(imax)); endif + endif + + psz = round(8*scale_C/128); + + ado = sprintf ("-annotate +%i+%i \"%s\"",\ + 2,\ + psz,\ + ado); + aup = sprintf ("-annotate +%i+%i \"%s\"",\ + scale_C-length(aup)*round(5*psz/10)-3,\ + psz,\ + aup); + + + imwrite (tn, uint8 (scale_im),[aup; ado; sprintf("-pointsize %i",psz)]); + scale_im = imread (tn); + unlink (tn); + + pC = max (scale_C, C); + padded_im = 255*ones (R+scale_R,pC); + + padded_im(1:R,floor((pC-C)/2)+(1:C)) = im; + padded_im(R+1:R+scale_R,floor((pC-scale_C)/2)+(1:scale_C)) = \ + double (scale_im); + im = padded_im; +endif + +if colormap && !is_col + + sz = size (im); + + if prod (size (colormap)) == 1 + colormap = rainbow()(end:-1:1,:); + end + ncol = rows (colormap); + cmap = 255*interp1 ((1:ncol),colormap,linspace(1,ncol,256))'; + + nanpix = isnan (im); + im(nanpix) = 0; # Dummy value, replacement is done below + im = reshape (cmap (:,1+floor(im(:))),3*sz(1),sz(2)); + + if show_range # Get the text back in bw + im(3*R+(1:3*scale_R),1:floor((pC-scale_C)/2)) = 255; + im(3*R+(1:3*scale_R),floor((pC+scale_C)/2):end) = 255; + im(3*R+(1:3*scale_R/2),floor((pC-scale_C)/2)+(1:scale_C)) = \ + kron (double (scale_im(1:scale_R/2,:)),ones(3,1)); + endif + + nanpix = !!reshape ([1;1;1]*nanpix(:)', size(im)); + im(nanpix) = nan; + is_col = 1; +endif + +#imin +#imax +#length(create_set(im)) + +assert (all (im(:) >= 0 | isnan (im(:)))); +assert (all (im(:) <= 255 | isnan (im(:)))); + + # Process text annotation commands +wopts = ""; +i = 1; +while i < length (text) + if !isnumeric (text{i}), + error ("Arg of type '%s' where numeric required, in 'text' option",\ + typeinfo(text{i})); + end + if length (text{i}) != 2 && length (text{i}) != 3 + error ("Position argument has size %s (should have 2 or 3 elements)",\ + sprintf("%i x ",size(text{i})(1:end-3))); + endif + if !ischar (text{i+1}), + error ("Arg of type '%s' where string required, in 'text' option",\ + typeinfo(text{i+1})); + endif + if !length (text{i+1}), i+=2; continue; endif + + ptsz = floor (C0/16); # Size of text characters (in orig image) + if length (text{i}) == 3, ptsz = text{i}(3); endif + + # Height and Width of text box + tmp = [1, text{i+1} == "\n"]; + if tmp(end), tmp = tmp(1:end-1); endif + tmp = cumsum (tmp); + tmp = loop_add (zeros(1,max(tmp)),tmp); + + txtsz = [length(tmp),max(tmp)-1]; + + # Choose a color, white, gray or black according + # to histogram of image in bounding box. + txtbb = (text{i}([2,1,2,1])(:)' + [-txtsz(1),0,0,txtsz(2)] * ptsz/2) * scl; + txtbb = round (txtbb); + txtbb = min (txtbb, size(im)([1 2 1 2])); + txtbb = max (txtbb, 1); + + bbh = hist (im(txtbb(1):txtbb(3),txtbb(2):txtbb(4))(:),[55,127,200]); + bbh = 0.98*bbh + 0.01*bbh([1 1 2]) + 0.01*bbh([2 3 3]); + [dummy,tmp] = min (bbh); + ##im(txtbb(1):txtbb(3),txtbb(2):txtbb(4)) = 0; + fillColorStr = {"-fill \"#000000\" ",\ + "-fill \"#A0A0A0\" ",\ + "-fill \"#ffffff\" "}{tmp}; + + wopts = [wopts, fillColorStr]; + + wopts = [wopts, sprintf("-pointsize %i ",ptsz*scl)]; + + #wopts = [wopts, sprintf("-annotate +%i+%i \"%s\" ",text{i}(1:2),text{i+1})]; + wopts = [wopts, sprintf("-draw \"text %i,%i '%s'\" ",scl*text{i}(1:2),text{i+1})]; + i += 2; +endwhile # EOF loop thru text annotation commands + +i = 1; +while i <= length (line) + ll = line{i}(:); + lll = length(ll); + if !isnumeric (ll) + error ("%ith 'line' argument is of type '%s', not numeric",\ + i, typeinfo(line{i})); + endif + + if lll < 4 + error ("%ith 'line' argument has %i elements, 4 at least are needed",\ + i, lll); + endif + if lll > 8 + error ("%ith 'line' argument has %i elements, 8 at most are taken",\ + i, lll) + endif + rgb = [nan,nan,nan]; + wid = nan; + switch lll + case 4, # All defaults + case 5, rgb = ll(5)*[1 1 1]; # x,y,x,y,c + # x,y,x,y,c, w + case 6, rgb = ll(5)*[1 1 1]; wid = ll(6); + case 7, rgb = ll(5:7)'; + case 8, rgb = ll(5:7)'; wid = ll(8); + endswitch + if all (!isnan (ll(1:4))) # Don't bother for nans + if !isnan (wid), + wopts = [wopts, sprintf("-stroke-width %i ",wid)]; + endif + if all(!isnan (rgb)), + wopts = [wopts, sprintf("-fill \"#%02x%02x%02x\" ",rgb)]; + endif + wopts = [wopts, sprintf("-draw \"line %i,%i %i,%i\" ",ll(1:4))]; + else + printf ("myimage: Hey, there's some 'nan' in the %i'th line argument\n",i); + endif + i++; + #wopts +endwhile # EOF loop thru lines + +nanmask = isnan(im); +im(nanmask) = 0; + + # Do I need to use libmagick to save and + # display, or because save was requested, or to + # annotate image. +if do_show || filename || length(wopts) + + # If I save, should I do sthing for transparency? + nanmaskfile = ""; + if filename && any (nanmask(:))\ + && (strcmp (filename(end-3:end), ".png")\ + || strcmp (filename(end-3:end), ".gif")) + + nanmaskfile = "tmp-mask.pgm" + imwrite (nanmaskfile, uint8 (255*!nanmask)); + ##myimage (nanmask); + endif + + if !is_col + if !filename, filename = "tmp.pgm"; endif + imwrite (filename, uint8 (im), wopts); + else + + if !filename, filename = "tmp.ppm"; endif + RC3 = prod (size(im)); + RC = size(im)./[3 1]; + + imwrite (filename, \ + reshape(uint8 (im(1:3:RC3)),RC),\ + reshape(uint8 (im(2:3:RC3)),RC),\ + reshape(uint8 (im(3:3:RC3)),RC),\ + wopts); + + end + # If there's transparency, do a separate call to convert + if length(nanmaskfile) + ["convert ",filename," ",\ + "tmp-mask.pgm -quality 100 +matte -compose CopyOpacity ",\ + filename] + system (["cp ",filename," tmp-im.png"]) + system (["convert ",filename," ",\ + "tmp-mask.pgm -quality 100 +matte -compose CopyOpacity ",\ + filename]); + endif + if do_show + + [o,s] = system ([viewer, " ",filename," ",dont_wait]); + if s + error("%s exited w/ status %im after \ + outputing<<EOF\n%s\nEOF\n",viewer,s,o); + endif + endif + # If I annotated image, annotation is now in + # file, but not in im, so I load im from file + if length(wopts) && nargout + im = imread (filename); + assert (all (im(:) >= 0)); + assert (all (im(:) <= 255)); + end +end + +assert (all (im(:) >= 0)); +assert (all (im(:) <= 255)); + +if !nargout, clear im; endif + + +endfunction + +%!demo +%! +%! myimage (randn(3,3), "show_range") +%! myimage (rand(9,3), "is_col") +%! myimage (randn(32,32), "minsz",[32,50]) +%! myimage (ones(64,1)*linspace(0,1,256), "colormap") +%! myimage (linspace(0,3,256)'*ones(1,64), "range",[3 1]) +%! myimage (zeros(200,200), "text",[10,20],">> 1 + pi\nans = 4.1416\n>>") +%! +%! im = kron (ones(4), kron (eye(2),ones(10))); +%! im += ones (80,1)*linspace(0,1/2,80); +%! myimage (im,"text",[11,5],"Hello","text", [10,30,30],"world")